Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/30/14 01:41:54 (10 years ago)
Author:
bburlacu
Message:

#1772: Worked towards integrating the new graph api with the tracking operators.

Location:
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj

    r11232 r11233  
    176176    <Compile Include="Analyzers\SymbolicDataAnalysisSingleObjectivePruningAnalyzer.cs" />
    177177    <Compile Include="Analyzers\SymbolicDataAnalysisGenealogyAnalyzer.cs" />
    178     <Compile Include="Analyzers\SymbolicDataAnalysisPopulationDiversityAnalyzer.cs" />
    179178    <Compile Include="Analyzers\SymbolicDataAnalysisSingleObjectiveValidationParetoBestSolutionAnalyzer.cs" />
    180179    <Compile Include="Analyzers\SymbolicDataAnalysisSingleObjectiveTrainingParetoBestSolutionAnalyzer.cs" />
     
    190189      <SubType>Code</SubType>
    191190    </Compile>
    192     <Compile Include="DirectedGraph\Arc.cs" />
    193     <Compile Include="DirectedGraph\DirectedGraph.cs" />
    194     <Compile Include="DirectedGraph\Interfaces\IArc.cs" />
    195     <Compile Include="DirectedGraph\Interfaces\IDirectedGraph.cs" />
    196     <Compile Include="DirectedGraph\Interfaces\IVertex.cs" />
    197     <Compile Include="DirectedGraph\Vertex.cs" />
    198191    <Compile Include="Interfaces\IModelBacktransformator.cs" />
    199192    <Compile Include="Interfaces\IDistanceCalculator.cs" />
     
    213206    <Compile Include="SlidingWindow\SlidingWindowQualitiesAnalyzer.cs" />
    214207    <Compile Include="SlidingWindow\SlidingWindowVisualizer.cs" />
    215     <Compile Include="SymbolGraph\FPGraph.cs" />
    216     <Compile Include="SymbolGraph\SymbolGraph.cs" />
    217208    <Compile Include="SymbolicDataAnalysisExpressionPruningOperator.cs" />
    218209    <Compile Include="SymbolicDataAnalysisExpressionTreeSimilarityCalculator.cs" />
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisProblem.cs

    r11232 r11233  
    235235      Operators.Add(new SingleObjectivePopulationDiversityAnalyzer());
    236236      Operators.Add(new BottomUpSimilarityCalculator());
     237      Operators.Add(new SymbolicDataAnalysisGenealogyAnalyzer());
    237238      ParameterizeOperators();
    238239    }
     
    361362        op.SimilarityCalculator = operators.OfType<BottomUpSimilarityCalculator>().SingleOrDefault();
    362363      }
     364      // add tracking analyzer
     365      foreach (var op in operators.OfType<SymbolicDataAnalysisGenealogyAnalyzer>()) {
     366        op.BeforeCrossoverOperatorParameter.ActualValue = new SymbolicDataAnalysisExpressionBeforeCrossoverOperator();
     367        op.AfterCrossoverOperatorParameter.ActualValue = new SymbolicDataAnalysisExpressionAfterCrossoverOperator();
     368        op.BeforeManipulatorOperatorParameter.ActualValue = new SymbolicDataAnalysisExpressionBeforeManipulatorOperator();
     369        op.AfterManipulatorOperatorParameter.ActualValue = new SymbolicDataAnalysisExpressionAfterManipulatorOperator();
     370        // get crossover parameter names
     371        var crossover = operators.OfType<ISymbolicExpressionTreeCrossover>().FirstOrDefault();
     372        if (crossover != null) {
     373          op.BeforeCrossoverOperator.ParentsParameter.ActualName = crossover.ParentsParameter.Name;
     374          op.AfterCrossoverOperator.ParentsParameter.ActualName = crossover.ParentsParameter.Name;
     375          op.BeforeCrossoverOperator.ChildParameter.ActualName = crossover.ChildParameter.Name;
     376          op.AfterCrossoverOperator.ChildParameter.ActualName = crossover.ChildParameter.Name;
     377        }
     378        // get manipulator parameter names
     379        var manipulator = operators.OfType<ISymbolicExpressionTreeManipulator>().FirstOrDefault();
     380        if (manipulator != null) {
     381          op.BeforeManipulatorOperator.ChildParameter.ActualName = manipulator.SymbolicExpressionTreeParameter.Name;
     382          op.AfterManipulatorOperator.ChildParameter.ActualName = manipulator.SymbolicExpressionTreeParameter.Name;
     383        }
     384        var creator = operators.OfType<ISymbolicExpressionTreeCreator>().FirstOrDefault();
     385        if (creator != null) {
     386          op.PopulationParameter.ActualName = creator.SymbolicExpressionTreeParameter.ActualName;
     387        }
     388      }
    363389    }
    364390
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/SymbolicDataAnalysisExpressionAfterCrossoverOperator.cs

    r10897 r11233  
    3030  public class SymbolicDataAnalysisExpressionAfterCrossoverOperator : AfterCrossoverOperator<ISymbolicExpressionTree> {
    3131    public override IOperation Apply() {
    32       var childVertex = (IGenealogyGraphNode<ISymbolicExpressionTree>)GenealogyGraph.GetVertex(ChildParameter.ActualValue);
     32      var childVertex = (IGenealogyGraphNode<ISymbolicExpressionTree>)GenealogyGraph.GetByContent(ChildParameter.ActualValue);
    3333      var arcs = childVertex.InArcs.ToList();
    3434      var nodes0 = (List<ISymbolicExpressionTreeNode>)arcs[0].Data;
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/SymbolicDataAnalysisExpressionAfterManipulatorOperator.cs

    r10897 r11233  
    4040
    4141    public override IOperation Apply() {
    42       var vChild = (IGenealogyGraphNode<ISymbolicExpressionTree>)GenealogyGraph.GetVertex(ChildParameter.ActualValue);
     42      var vChild = (IGenealogyGraphNode<ISymbolicExpressionTree>)GenealogyGraph.GetByContent(ChildParameter.ActualValue);
    4343      var nodesBefore = (List<ISymbolicExpressionTreeNode>)vChild.InArcs.First().Data;
    4444      var nodesAfter = ChildParameter.ActualValue.IterateNodesPrefix().ToList();
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/SymbolicDataAnalysisExpressionBeforeCrossoverOperator.cs

    r10897 r11233  
    3030      var result = base.Apply(); // the base operator will add the child to the graph before the actual crossover operation takes place
    3131      var parents = ParentsParameter.ActualValue.ToList();
    32       var childVertex = (IGenealogyGraphNode<ISymbolicExpressionTree>)GenealogyGraph.GetVertex(parents[0]); // use the parent since it is actually the child before crossover (and the ChildParameter doesn't have a value yet)
     32      var childVertex = (IGenealogyGraphNode<ISymbolicExpressionTree>)GenealogyGraph.GetByContent(parents[0]); // use the parent since it is actually the child before crossover (and the ChildParameter doesn't have a value yet)
    3333      var arcs = childVertex.InArcs.ToList();
    3434
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/SymbolicDataAnalysisExpressionBeforeManipulatorOperator.cs

    r10897 r11233  
    3030      var result = base.Apply(); // add the vertex in the genealogy graph
    3131
    32       var vChild = (IGenealogyGraphNode<ISymbolicExpressionTree>)GenealogyGraph.GetVertex(ChildParameter.ActualValue);
     32      var vChild = (IGenealogyGraphNode<ISymbolicExpressionTree>)GenealogyGraph.GetByContent(ChildParameter.ActualValue);
    3333      var vClone = vChild.Parents.Last();
    3434      vChild.InArcs.First().Data = vClone.Content.IterateNodesPrefix().ToList();
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/SymbolicDataAnalysisExpressionTracing.cs

    r10888 r11233  
    3030  public static class SymbolicDataAnalysisExpressionTracing {
    3131    public static FragmentGraph TraceSubtree(IGenealogyGraphNode<ISymbolicExpressionTree> graphNode, int subtreeIndex) {
    32       var graph = new FragmentGraph { AllowDuplicateContent = true };
     32      var graph = new FragmentGraph();
    3333      var nodes = Trace(graphNode, subtreeIndex);
    3434      foreach (var n in nodes) {
     
    5151      while (true) {
    5252        if (!node.Parents.Any()) {
    53           var fragmentNode = new FragmentNode {
    54             Content = node,
     53          var fragmentNode = new FragmentNode(node) {
    5554            SubtreeIndex = index,
    5655          };
    5756          if (parent != null) {
    5857            var arc = new Arc(parent, fragmentNode);
    59             parent.AddForwardArc(arc);
    60             fragmentNode.AddReverseArc(arc);
     58            parent.AddArc(arc);
     59            fragmentNode.AddArc(arc);
     60
     61            //            parent.AddForwardArc(arc);
     62            //            fragmentNode.AddReverseArc(arc);
    6163          }
    6264          yield return fragmentNode; // no tracing if there are no parents
     
    7981        if (parents.Count == 1) {
    8082          // we are tracing a mutation operation
    81           var fragmentNode = new FragmentNode {
    82             Content = node,
     83          var fragmentNode = new FragmentNode(node) {
    8384            SubtreeIndex = index,
    8485            FragmentIndex = fragment.Index1
     
    8687          if (parent != null) {
    8788            var arc = new Arc(parent, fragmentNode);
    88             parent.AddForwardArc(arc);
    89             fragmentNode.AddReverseArc(arc);
     89            parent.AddArc(arc);
     90            fragmentNode.AddArc(arc);
    9091          }
    9192          node = parents[0];
     
    138139            if (fragment.Index1 < index + subtreeLength) {
    139140              // subtree contains fragment => bifurcation point in the fragment graph
    140               var fragmentNode = new FragmentNode {
    141                 Content = node,
     141              var fragmentNode = new FragmentNode(node) {
    142142                SubtreeIndex = index,
    143143                FragmentIndex = fragment.Index1
     
    145145              if (parent != null) {
    146146                var arc = new Arc(parent, fragmentNode);
    147                 parent.AddForwardArc(arc);
    148                 fragmentNode.AddReverseArc(arc);
     147                parent.AddArc(arc);
     148                fragmentNode.AddArc(arc);
    149149              }
    150150              yield return fragmentNode;
Note: See TracChangeset for help on using the changeset viewer.