Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/26/14 17:14:14 (10 years ago)
Author:
bburlacu
Message:

#1772: Found bug in GenealogyGraph creation, attempted fix by injecting vertex guid's in the individual scopes.

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

    r10650 r10674  
    211211        ConfigureTrackingOperators();
    212212
    213         foreach (var individual in population) {
     213        for (int i = 0; i < population.Count; ++i) {
     214          var individual = population[i];
    214215          var vertex = new GenealogyGraphNode<T> { Content = individual, Rank = Generations.Value, };
    215216          GenealogyGraph.AddVertex(vertex);
     217          // save the vertex id in the individual scope (so that we can identify graph indices)
     218          ExecutionContext.Scope.SubScopes[i].Variables.Add(new Variable("Id", new StringValue(vertex.Id)));
    216219        }
    217220      } else {
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Operators/BeforeCrossoverOperator.cs

    r10650 r10674  
    2525using HeuristicLab.Common;
    2626using HeuristicLab.Core;
     27using HeuristicLab.Data;
    2728using HeuristicLab.Parameters;
    2829using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    6364      if (CurrentGeneration == null) throw new Exception();
    6465      // we get the parents by parsing the scope name because the individuals in the execution scope are clones of the ones saved in the graph
    65       var parentVertices = ExecutionContext.Scope.SubScopes.Select(s => CurrentGeneration[int.Parse(s.Name)]).ToList();
     66      //      var parentVertices = ExecutionContext.Scope.SubScopes.Select(s => CurrentGeneration.Find(x => x.Id == ((StringValue)s.Variables["Id"].Value)).ToList();
     67      var parentVertices = (from s in ExecutionContext.Scope.SubScopes
     68                            let id = ((StringValue)s.Variables["Id"].Value).Value
     69                            select CurrentGeneration.First(x => x.Id == id)).ToList(); // the id is unique
    6670
    6771      var parents = ParentsParameter.ActualValue.ToList();
     
    7781        v.AddForwardArc(childVertex);
    7882      }
     83      ExecutionContext.Scope.Variables.Add(new Variable("Id", new StringValue(childVertex.Id)));
    7984
    8085      return base.Apply();
Note: See TracChangeset for help on using the changeset viewer.