Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/16/14 16:37:56 (10 years ago)
Author:
bburlacu
Message:

#1772: Small changes to the GenealogyGraph. Added generic Fragment class and interface. Added the SymbolicDataAnalysisPopulationDiversityAnalyzer. Added specialized tracking operators for symbolic data analysis. Merged trunk changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Operators/AfterCrossoverOperator.cs

    r10300 r10347  
    2020#endregion
    2121
    22 using System.Linq;
    2322using HeuristicLab.Common;
    2423using HeuristicLab.Core;
     
    2928  [StorableClass]
    3029  [Item("AfterCrossoverOperator", "A generic operator that can record genealogical relationships between crossover parents and children.")]
    31   public class AfterCrossoverOperator<T> : EvolutionTrackingOperator
    32     where T : class,IItem {
     30  public class AfterCrossoverOperator<T> : EvolutionTrackingOperator, ICrossoverOperator<T> where T : class,IItem {
    3331    private const string defaultParentsParameterName = "Parents";
    3432    private const string defaultChildParameterName = "Child";
    35     public IScopeTreeLookupParameter<T> ParentsParameter;
    36     public ILookupParameter<T> ChildParameter;
     33    public IScopeTreeLookupParameter<T> ParentsParameter { get; set; }
     34    public ILookupParameter<T> ChildParameter { get; set; }
    3735
    3836    protected AfterCrossoverOperator(AfterCrossoverOperator<T> original, Cloner cloner)
     
    5149
    5250    public override IOperation Apply() {
    53       //      var parentVertices = ParentsParameter.ActualValue.Select(x => GenealogyGraph[x].Last()).ToList();
    54       var lastGen = GenealogyGraph.Ranks[Generations.Value].ToList();
    55       var parentVertices = ExecutionContext.Scope.SubScopes.Select(s => lastGen[int.Parse(s.Name)]).ToList(); // because the individuals in the execution scope are copies of the ones in the graph
    56 
    57       var childVertex = new GenealogyGraphNode<T> {
    58         Content = ChildParameter.ActualValue,
    59         Rank = parentVertices[0].Rank + 1
    60       };
    61       GenealogyGraph.AddVertex(childVertex);
    62       foreach (var v in parentVertices) {
    63         childVertex.AddReverseArc(v);
    64         v.AddForwardArc(childVertex);
    65       }
    66       //      if (parentVertices[0].Content == parentVertices[1].Content)
    67       //        throw new Exception("Self-crossover");
    6851      return base.Apply();
    6952    }
Note: See TracChangeset for help on using the changeset viewer.