- Timestamp:
- 02/16/09 01:21:53 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.SimOpt/SimOptSinglePointCrossover.cs
r637 r1218 40 40 } 41 41 42 protected override void Cross(IScope scope, IRandom random , IScope parent1, IScope parent2, IScope child) {42 protected override void Cross(IScope scope, IRandom random) { 43 43 ICollection<IConstraint> violated; 44 ConstrainedItemList p1 = parent1.GetVariableValue<ConstrainedItemList>("Item", false);45 ConstrainedItemList p2 = parent2.GetVariableValue<ConstrainedItemList>("Item", false);44 ConstrainedItemList p1 = scope.SubScopes[0].GetVariableValue<ConstrainedItemList>("Item", false); 45 ConstrainedItemList p2 = scope.SubScopes[1].GetVariableValue<ConstrainedItemList>("Item", false); 46 46 47 47 if (p1.Count != p2.Count) throw new InvalidOperationException("ERROR: the lists do not contain the same number of items"); … … 58 58 } while (!childList.EndCombinedOperation(out violated) && ++iter < 100); 59 59 if (violated.Count == 0) { 60 child.AddVariable(new Variable(parent1.TranslateName("Item"), childList));60 scope.AddVariable(new Variable(scope.SubScopes[0].TranslateName("Item"), childList)); 61 61 } 62 62 }
Note: See TracChangeset
for help on using the changeset viewer.