Free cookie consent management tool by TermsFeed Policy Generator

Changeset 11288


Ignore:
Timestamp:
08/19/14 16:05:16 (10 years ago)
Author:
bburlacu
Message:

#1772: Fix calculation of successful offspring ratios in the GenealogyAnalyzer. Simplify cloning in the BeforeManipulatorOperator.

Location:
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Analyzers/GenealogyAnalyzer.cs

    r11278 r11288  
    346346      foreach (var ind in population) {
    347347        var v = GenealogyGraph.GetByContent(ind);
    348         foreach (var p in v.Parents)
    349           p.Weight++;
     348        if (v.Parents.Count() == 1) {
     349          var p = v.Parents.First();
     350          foreach (var pp in p.Parents)
     351            pp.Weight++;
     352        } else {
     353          foreach (var p in v.Parents) {
     354            p.Weight++;
     355          }
     356        }
    350357      }
    351358
     
    364371      }
    365372      var successfulOffspringRatioTable = new DataTable();
    366       var successfulOffspringRatioRow = new DataRow("Successful Offspring Ratio") { VisualProperties = { ChartType = DataRowVisualProperties.DataRowChartType.Columns, StartIndexZero = true } };
     373      var successfulOffspringRatioRow = new DataRow("Successful Offspring Ratio") {
     374        VisualProperties = { ChartType = DataRowVisualProperties.DataRowChartType.Columns, StartIndexZero = true }
     375      };
    367376      successfulOffspringRatioRow.Values.Replace(GenealogyGraph.Ranks[generation - 1].OrderByDescending(x => x.Quality).Select(x => x.OutDegree > 0 ? x.Weight / x.OutDegree : 0));
    368377      successfulOffspringRatioTable.Rows.Add(successfulOffspringRatioRow);
     
    385394
    386395      var successfulOffspringValuesTable = new DataTable();
    387       var successfulOffspringValuesRow = new DataRow("Successful Offspring Ratio") {
     396      var successfulOffspringValuesRow = new DataRow("Successful Offspring Values") {
    388397        VisualProperties = { ChartType = DataRowVisualProperties.DataRowChartType.Columns, StartIndexZero = true }
    389398      };
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Operators/BeforeManipulatorOperator.cs

    r11257 r11288  
    5454      // since mutation always takes place after crossover, the vertex for the current child is already in the tree
    5555      var v = (IGenealogyGraphNode<T>)GenealogyGraph.GetByContent(ChildParameter.ActualValue);
    56       var clone = (T)ChildParameter.ActualValue.Clone();
    57       var c = new GenealogyGraphNode<T>(clone) { Rank = v.Rank - 0.5 };
     56      var c = (IGenealogyGraphNode<T>)v.Clone();
     57      c.Rank = v.Rank - 0.5;
    5858      GenealogyGraph.AddVertex(c);
    5959
Note: See TracChangeset for help on using the changeset viewer.