Free cookie consent management tool by TermsFeed Policy Generator

Changeset 11262


Ignore:
Timestamp:
08/04/14 14:50:52 (10 years ago)
Author:
bburlacu
Message:

#1772: Added missing Storable constructor to GenealogyGraphNode<T> class. Prefer cloning vertices in the GenealogyAnalyzer. Add In/Out Degree in node tooltip in the GenealogyGraphChart.

Location:
branches/HeuristicLab.EvolutionTracking
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking.Views/3.4/GenealogyGraphChart.cs

    r10903 r11262  
    117117            ToolTipText = "Rank: " + node.Rank + nl +
    118118                          "Quality: " + String.Format("{0:0.0000}", node.Quality) + nl +
    119                           "IsElite: " + node.IsElite
     119                          "IsElite: " + node.IsElite + nl +
     120                          "In/Out Degree: " + node.InDegree + " " + node.OutDegree
    120121          };
    121122          Chart.Group.Add(visualNode);
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking.Views/3.4/HeuristicLab.EvolutionTracking.Views-3.4.csproj

    r11253 r11262  
    9797      <DependentUpon>FrequentFragmentsDialog.cs</DependentUpon>
    9898    </Compile>
    99     <Compile Include="GenealogyGraphChart.cs" />
     99    <Compile Include="GenealogyGraphChart.cs">
     100      <SubType>UserControl</SubType>
     101    </Compile>
    100102    <Compile Include="GenealogyGraphChart.Designer.cs">
    101103      <DependentUpon>GenealogyGraphChart.cs</DependentUpon>
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Analyzers/GenealogyAnalyzer.cs

    r11257 r11262  
    272272          var prevVertex = (IGenealogyGraphNode<T>)GenealogyGraph.GetByContent(elite);
    273273          prevVertex.IsElite = true; // mark elites in the graph retroactively
    274           var w = new GenealogyGraphNode<T>(prevVertex); //shallow copy, arcs are not copied
     274          var w = (IGenealogyGraphNode<T>)prevVertex.Clone();
    275275          var v = new GenealogyGraphNode<T>(prevVertex.Data) {
    276276            Rank = generation,
     
    321321      int generation = GenerationsParameter.ActualValue.Value;
    322322      var population = PopulationParameter.ActualValue;
    323       var discardedOffspring = GenealogyGraph.Ranks[generation].Select(x => (T)x.Data).Except(population);
     323      var discardedOffspring = GenealogyGraph.Ranks[generation].Select(x => (T)x.Data).Except(population).ToList();
    324324      foreach (var vertex in discardedOffspring.Select(individual => GenealogyGraph.GetByContent(individual))) {
    325325        if (vertex.InDegree == 1) {
    326326          var p = vertex.Parents.First();
    327           if (p.Rank.Equals(generation - 1))
     327          if (!p.Rank.Equals(generation - 0.5))
    328328            throw new InvalidOperationException("Parent must be an intermediate vertex");
    329329          GenealogyGraph.RemoveVertex(p);
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/GenealogyGraphNode.cs

    r11253 r11262  
    3636    public override IDeepCloneable Clone(Cloner cloner) {
    3737      return new GenealogyGraphNode(this, cloner);
    38     }
    39 
    40     // this constructor emulates the behavior of a copy constructor
    41     // it returns a shallow copy in which the arcs are not cloned
    42     protected GenealogyGraphNode(IGenealogyGraphNode original)
    43       : base((IDeepCloneable)original.Data.Clone()) {
    44       Quality = original.Quality;
    45       Rank = original.Rank;
    46       IsElite = original.IsElite;
    47       Id = Guid.NewGuid().ToString();
    4838    }
    4939
     
    146136    }
    147137
    148     public GenealogyGraphNode(IGenealogyGraphNode<T> original) : base(original) { }
     138    [StorableConstructor]
     139    protected GenealogyGraphNode(bool deserializing) : base(deserializing) { }
    149140
    150141    public GenealogyGraphNode(IDeepCloneable content) : base(content) { }
Note: See TracChangeset for help on using the changeset viewer.