Changeset 10674 for branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Operators
- Timestamp:
- 03/26/14 17:14:14 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Operators/BeforeCrossoverOperator.cs
r10650 r10674 25 25 using HeuristicLab.Common; 26 26 using HeuristicLab.Core; 27 using HeuristicLab.Data; 27 28 using HeuristicLab.Parameters; 28 29 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 63 64 if (CurrentGeneration == null) throw new Exception(); 64 65 // 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 66 70 67 71 var parents = ParentsParameter.ActualValue.ToList(); … … 77 81 v.AddForwardArc(childVertex); 78 82 } 83 ExecutionContext.Scope.Variables.Add(new Variable("Id", new StringValue(childVertex.Id))); 79 84 80 85 return base.Apply();
Note: See TracChangeset
for help on using the changeset viewer.