Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/04/14 12:56:05 (10 years ago)
Author:
bburlacu
Message:

#1772: Modified GenealogyAnalyzer to remove discarded offspring selection children from the genealogy graph.

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

    r10897 r10936  
    137137      get { return GenerationsParameter.ActualValue; }
    138138    }
     139
    139140    public IGenealogyGraph<T> GenealogyGraph {
    140141      get {
     
    281282
    282283          prevVertex.Content = clone;
    283 
     284          // inject the graph node unique id to the scope
    284285          ExecutionContext.Scope.SubScopes[index].Variables["Id"].Value = new StringValue(vertex.Id);
    285286
     
    299300      }
    300301
     302      // remove extra graph nodes (added by the instrumented operators in the case of offspring selection)
     303      var discardedOffspring = GenealogyGraph.Ranks[Generations.Value].Select(x => (T)x.Content).Except(population).ToList();
     304      foreach (var individual in discardedOffspring) {
     305        var vertex = GenealogyGraph.GetVertex(individual);
     306        GenealogyGraph.RemoveVertex(vertex);
     307      }
     308
    301309      return base.Apply();
    302310    }
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/DirectedGraph/DirectedGraph.cs

    r10903 r10936  
    128128          throw new Exception("Content already exists in the graph.");
    129129        }
    130         contentMap.Add(vertex.Content, vertex);
     130        contentMap[vertex.Content] = vertex;
    131131      }
    132132      idMap.Add(vertex.Id, vertex);
Note: See TracChangeset for help on using the changeset viewer.