- Timestamp:
- 06/20/11 13:36:49 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Zhu/Crossovers/ZhuPermutationCrossover.cs
r5445 r6449 48 48 49 49 protected override ZhuEncoding Crossover(IRandom random, ZhuEncoding parent1, ZhuEncoding parent2) { 50 //note - the inner crossover is called here and the resultis converted to a prins representation50 //note - the inner crossover is called here and the solution is converted to a prins representation 51 51 //some refactoring should be done here in the future - the crossover operation should be called directly 52 52 53 InnerCrossoverParameter.ActualValue.ParentsParameter.ActualName = ParentsParameter.ActualName; 54 IAtomicOperation op = this.ExecutionContext.CreateOperation( 55 InnerCrossoverParameter.ActualValue, this.ExecutionContext.Scope); 56 op.Operator.Execute((IExecutionContext)op, CancellationToken); 53 if (parent1.Length == parent2.Length) { 54 InnerCrossoverParameter.ActualValue.ParentsParameter.ActualName = ParentsParameter.ActualName; 55 IAtomicOperation op = this.ExecutionContext.CreateOperation( 56 InnerCrossoverParameter.ActualValue, this.ExecutionContext.Scope); 57 op.Operator.Execute((IExecutionContext)op, CancellationToken); 57 58 58 string childName = InnerCrossoverParameter.ActualValue.ChildParameter.ActualName;59 if (ExecutionContext.Scope.Variables.ContainsKey(childName)) {60 Permutation permutation = ExecutionContext.Scope.Variables[childName].Value as Permutation;61 ExecutionContext.Scope.Variables.Remove(childName);59 string childName = InnerCrossoverParameter.ActualValue.ChildParameter.ActualName; 60 if (ExecutionContext.Scope.Variables.ContainsKey(childName)) { 61 Permutation permutation = ExecutionContext.Scope.Variables[childName].Value as Permutation; 62 ExecutionContext.Scope.Variables.Remove(childName); 62 63 63 return new ZhuEncoding(permutation, Cities, 64 DueTimeParameter.ActualValue, 65 ServiceTimeParameter.ActualValue, 66 ReadyTimeParameter.ActualValue, 67 DemandParameter.ActualValue, 68 CapacityParameter.ActualValue, 69 CoordinatesParameter.ActualValue, 70 UseDistanceMatrixParameter.ActualValue); 71 } else 72 return null; 64 return new ZhuEncoding(permutation, Cities, 65 DueTimeParameter.ActualValue, 66 ServiceTimeParameter.ActualValue, 67 ReadyTimeParameter.ActualValue, 68 DemandParameter.ActualValue, 69 CapacityParameter.ActualValue, 70 CoordinatesParameter.ActualValue, 71 UseDistanceMatrixParameter.ActualValue); 72 } else 73 return null; 74 } else { 75 return parent1.Clone() as ZhuEncoding; 76 } 73 77 } 74 78 }
Note: See TracChangeset
for help on using the changeset viewer.