Free cookie consent management tool by TermsFeed Policy Generator

Changeset 10293


Ignore:
Timestamp:
01/07/14 12:31:18 (11 years ago)
Author:
bburlacu
Message:

#1772: Merged trunk changes to the branch projects. Fixed some small bugs in the GenealogyGraphArc, added SymbolicDataAnalysisGenealogyAnalyzer.cs as a facade to the generic analyzer (it looks nicer in the GUI).

Location:
branches/HeuristicLab.EvolutionTracking
Files:
1 added
13 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding

  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/DirectedGraph/Vertex.cs

    r10285 r10293  
    7878    // enforce the correct and desired behavior.
    7979    public void AddForwardArc(IVertex target, double w = 0.0, object data = null) {
    80       var e = new Arc { Source = this, Target = target, Data = data, Weight = w };
    81       if (OutArcs == null) OutArcs = new List<IArc> { e };
    82       else OutArcs.Add(e);
     80      var arc = new Arc { Source = this, Target = target, Data = data, Weight = w };
     81      if (OutArcs == null) OutArcs = new List<IArc> { arc };
     82      else OutArcs.Add(arc);
    8383    }
    8484    public void AddForwardArc(IArc arc) {
     
    9393    }
    9494    public void AddReverseArc(IVertex source, double w = 0.0, object data = null) {
    95       var e = new Arc { Source = source, Target = this, Data = data, Weight = w };
    96       if (InArcs == null) InArcs = new List<IArc> { e };
    97       else InArcs.Add(e);
     95      var arc = new Arc { Source = source, Target = this, Data = data, Weight = w };
     96      if (InArcs == null) InArcs = new List<IArc> { arc };
     97      else InArcs.Add(arc);
    9898    }
    9999
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/GenealogyGraphArc.cs

    r10285 r10293  
    3939      return new GenealogyGraphArc(this, cloner);
    4040    }
    41     public new IGenealogyGraphNode Source { get; set; }
    42     public new IGenealogyGraphNode Target { get; set; }
    4341
     42    public new IGenealogyGraphNode Source {
     43      get { return (IGenealogyGraphNode)base.Source; }
     44      set { base.Source = value; }
     45    }
    4446
     47    public new IGenealogyGraphNode Target {
     48      get { return (IGenealogyGraphNode)base.Target; }
     49      set { base.Target = value; }
     50    }
    4551  }
    4652
     
    6066    }
    6167    public new T Data {
    62       get {
    63         return (T)base.Data;
    64       }
    65       set {
    66         base.Data = value;
    67       }
     68      get { return (T)base.Data; }
     69      set { base.Data = value; }
    6870    }
    6971  }
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/GenealogyGraphNode.cs

    r10285 r10293  
    111111
    112112    public new void AddForwardArc(IVertex target, double w = 0, object data = null) {
    113       var e = new GenealogyGraphArc { Source = this, Target = (IGenealogyGraphNode)target, Data = data, Weight = w };
    114       base.AddForwardArc(e);
     113      var arc = new GenealogyGraphArc { Source = this, Target = (IGenealogyGraphNode)target, Data = data, Weight = w };
     114      base.AddForwardArc(arc);
    115115    }
    116116    public new void AddReverseArc(IVertex source, double w = 0.0, object data = null) {
    117       var e = new GenealogyGraphArc { Source = (IGenealogyGraphNode)source, Target = this, Data = data, Weight = w };
    118       base.AddReverseArc(e);
     117      var arc = new GenealogyGraphArc { Source = (IGenealogyGraphNode)source, Target = this, Data = data, Weight = w };
     118      base.AddReverseArc(arc);
    119119    }
    120120  }
     
    124124  public class GenealogyGraphNode<T> : GenealogyGraphNode, IGenealogyGraphNode<T> where T : class,IItem {
    125125    public T Content { get; set; }
    126 
     126    public GenealogyGraphNode() { }
    127127  }
    128128}
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Operators/AfterSolutionCreatorOperator.cs

    r10278 r10293  
    2121
    2222using HeuristicLab.Core;
    23 using HeuristicLab.Parameters;
    2423using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2524
     
    3231    where TContent : class,IItem {
    3332
    34     private string newIndividualParameterName;
    35     public string NewIndividualParameterName {
    36       get { return newIndividualParameterName; }
    37       set {
    38         if (newIndividualParameterName != null && Parameters.ContainsKey(newIndividualParameterName))
    39           Parameters.Remove(newIndividualParameterName);
    40         newIndividualParameterName = value;
    41         if (!Parameters.ContainsKey(newIndividualParameterName)) {
    42           Parameters.Add(new LookupParameter<TContent>(newIndividualParameterName));
    43         }
    44       }
    45     }
    46 
    47     public ILookupParameter<TContent> NewIndividualParameter {
    48       get { return (ILookupParameter<TContent>)Parameters[NewIndividualParameterName]; }
    49     }
    50     public TContent NewIndividual { get { return NewIndividualParameter.ActualValue; } }
    51 
    5233    public override IOperation Apply() {
    53       var vertex = new TVertex {
    54         Content = NewIndividual
    55       };
    56       GenealogyGraph.AddVertex(vertex);
    5734      return base.Apply();
    5835    }
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Operators/BeforeManipulatorOperator.cs

    r10285 r10293  
    2020#endregion
    2121
    22 using System.Collections.Generic;
    2322using System.Linq;
    2423using HeuristicLab.Common;
     
    5251    public override IOperation Apply() {
    5352      if (GenealogyGraph.Contains(ChildParameter.ActualValue)) {
    54         // if the individual has been affected by crossover before mutation, we keep it in the graph and feed a clone of it to the mutation operator
    5553        var child = ChildParameter.ActualValue;
    5654        var clone = (TContent)child.Clone();
    57         var vertex = GenealogyGraph[child].Last();
    58         vertex.Content = clone;
    59         GenealogyGraph.Ranks[vertex.Rank].Remove(vertex);
    60         var newVertex = new TVertex {
    61           Content = child,
    62           Rank = vertex.Rank
    63         };
    64         vertex.Rank -= 0.5;
    65         if (!GenealogyGraph.Ranks.ContainsKey(vertex.Rank)) {
    66           GenealogyGraph.Ranks[vertex.Rank] = new LinkedList<TVertex>();
     55        var vChild = GenealogyGraph[child].Last();
     56        var vClone = new TVertex { Content = clone, Rank = vChild.Rank - 0.5 };
     57        GenealogyGraph.AddVertex(vClone);
     58        // adjust parent-child(clone) relationship in the graph
     59        var parents = vChild.InArcs.Select(a => a.Source);
     60        vChild.InArcs.Clear();
     61        foreach (var p in parents) {
     62          foreach (var a in p.OutArcs) {
     63            if (a.Target == vChild)
     64              a.Target = vClone;
     65          }
     66          vClone.AddReverseArc(p);
    6767        }
    68         GenealogyGraph.Ranks[vertex.Rank].AddLast(vertex);
    69 
    70         newVertex.AddForwardArc(vertex);
    71         vertex.AddReverseArc(vertex);
    72       } else {
    73         // mutation should never happen without crossover
     68        vChild.AddReverseArc(vClone);
     69        vClone.AddForwardArc(vChild);
     70      } else { // this needs to be checked
     71        var vChild = new TVertex { Content = ChildParameter.ActualValue, Rank = Generations.Value };
     72        GenealogyGraph.AddVertex(vChild);
    7473      }
    7574      return base.Apply();
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic

  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4.csproj

    r10285 r10293  
    344344    </Content>
    345345  </ItemGroup>
    346   <ItemGroup>
    347     <EmbeddedResource Include="SymbolicDataAnalysisGenealogyView.resx">
    348       <DependentUpon>SymbolicDataAnalysisGenealogyView.cs</DependentUpon>
    349     </EmbeddedResource>
    350   </ItemGroup>
    351346  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    352347  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Evaluators/SymbolicDataAnalysisEvaluator.cs

    r9456 r10293  
    3535namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
    3636  [StorableClass]
    37   public abstract class SymbolicDataAnalysisEvaluator<T> : SingleSuccessorOperator,
     37  public abstract class SymbolicDataAnalysisEvaluator<T> : InstrumentedOperator,
    3838    ISymbolicDataAnalysisEvaluator<T>, ISymbolicDataAnalysisInterpreterOperator, ISymbolicDataAnalysisBoundedOperator, IStochasticOperator
    3939  where T : class, IDataAnalysisProblemData {
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj

    r10278 r10293  
    173173  </ItemGroup>
    174174  <ItemGroup>
     175    <Compile Include="Analyzers\SymbolicDataAnalysisGenealogyAnalyzer.cs" />
    175176    <Compile Include="Analyzers\SymbolicDataAnalysisSingleObjectiveValidationParetoBestSolutionAnalyzer.cs" />
    176177    <Compile Include="Analyzers\SymbolicDataAnalysisSingleObjectiveTrainingParetoBestSolutionAnalyzer.cs" />
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisProblem.cs

    r10285 r10293  
    2828using HeuristicLab.Data;
    2929using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    30 using HeuristicLab.EvolutionTracking;
    3130using HeuristicLab.Optimization;
    3231using HeuristicLab.Parameters;
    3332using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    3433using HeuristicLab.PluginInfrastructure;
     34using HeuristicLab.Problems.DataAnalysis.Symbolic.Analyzers;
    3535using HeuristicLab.Problems.Instances;
    3636
    37 using TGraph = HeuristicLab.EvolutionTracking.IGenealogyGraph<HeuristicLab.EvolutionTracking.GenealogyGraphNode<HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.ISymbolicExpressionTree>,
    38                                                               HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.ISymbolicExpressionTree>;
    39 using TVertex = HeuristicLab.EvolutionTracking.GenealogyGraphNode<HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.ISymbolicExpressionTree>;
    4037
    4138namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
     
    236233      Operators.Add(new MinAverageMaxSymbolicExpressionTreeLengthAnalyzer());
    237234      Operators.Add(new SymbolicExpressionTreeLengthAnalyzer());
    238       Operators.Add(new GenealogyAnalyzer<TGraph, TVertex, ISymbolicExpressionTree>());
     235      Operators.Add(new SymbolicDataAnalysisGenealogyAnalyzer());
    239236      ParameterizeOperators();
    240237    }
     
    357354      }
    358355      // add tracking analyzer
    359       foreach (var op in operators.OfType<GenealogyAnalyzer<TGraph, TVertex, ISymbolicExpressionTree>>()) {
     356      foreach (var op in operators.OfType<SymbolicDataAnalysisGenealogyAnalyzer>()) {
    360357        // get crossover parameter names
    361358        var crossover = operators.OfType<ISymbolicExpressionTreeCrossover>().First();
Note: See TracChangeset for help on using the changeset viewer.