Changeset 6760 for branches/PersistenceSpeedUp/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Prins/Crossovers
- Timestamp:
- 09/14/11 13:59:25 (13 years ago)
- Location:
- branches/PersistenceSpeedUp
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PersistenceSpeedUp
- Property svn:ignore
-
old new 12 12 *.psess 13 13 *.vsp 14 *.docstates
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/PersistenceSpeedUp/HeuristicLab.Problems.VehicleRouting
- Property svn:mergeinfo changed
-
branches/PersistenceSpeedUp/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Prins/Crossovers/PrinsPermutationCrossover.cs
r5445 r6760 46 46 47 47 protected override PrinsEncoding Crossover(IRandom random, PrinsEncoding parent1, PrinsEncoding parent2) { 48 //note - the inner crossover is called here and the resultis converted to a prins representation48 //note - the inner crossover is called here and the solution is converted to a prins representation 49 49 //some refactoring should be done here in the future - the crossover operation should be called directly 50 50 51 InnerCrossoverParameter.ActualValue.ParentsParameter.ActualName = ParentsParameter.ActualName; 52 IAtomicOperation op = this.ExecutionContext.CreateOperation( 53 InnerCrossoverParameter.ActualValue, this.ExecutionContext.Scope); 54 op.Operator.Execute((IExecutionContext)op, CancellationToken); 51 if (parent1.Length == parent2.Length) { 52 InnerCrossoverParameter.ActualValue.ParentsParameter.ActualName = ParentsParameter.ActualName; 53 IAtomicOperation op = this.ExecutionContext.CreateOperation( 54 InnerCrossoverParameter.ActualValue, this.ExecutionContext.Scope); 55 op.Operator.Execute((IExecutionContext)op, CancellationToken); 55 56 56 string childName = InnerCrossoverParameter.ActualValue.ChildParameter.ActualName;57 if (ExecutionContext.Scope.Variables.ContainsKey(childName)) {58 Permutation permutation = ExecutionContext.Scope.Variables[childName].Value as Permutation;59 ExecutionContext.Scope.Variables.Remove(childName);57 string childName = InnerCrossoverParameter.ActualValue.ChildParameter.ActualName; 58 if (ExecutionContext.Scope.Variables.ContainsKey(childName)) { 59 Permutation permutation = ExecutionContext.Scope.Variables[childName].Value as Permutation; 60 ExecutionContext.Scope.Variables.Remove(childName); 60 61 61 return new PrinsEncoding(permutation, Cities, 62 DueTimeParameter.ActualValue, 63 ServiceTimeParameter.ActualValue, 64 ReadyTimeParameter.ActualValue, 65 DemandParameter.ActualValue, 66 CapacityParameter.ActualValue, 67 FleetUsageFactor.ActualValue, 68 TimeFactor.ActualValue, 69 DistanceFactor.ActualValue, 70 OverloadPenalty.ActualValue, 71 TardinessPenalty.ActualValue, 72 CoordinatesParameter.ActualValue, 73 UseDistanceMatrixParameter.ActualValue); 74 } else 75 return null; 62 return new PrinsEncoding(permutation, Cities, 63 DueTimeParameter.ActualValue, 64 ServiceTimeParameter.ActualValue, 65 ReadyTimeParameter.ActualValue, 66 DemandParameter.ActualValue, 67 CapacityParameter.ActualValue, 68 FleetUsageFactor.ActualValue, 69 TimeFactor.ActualValue, 70 DistanceFactor.ActualValue, 71 OverloadPenalty.ActualValue, 72 TardinessPenalty.ActualValue, 73 CoordinatesParameter.ActualValue, 74 UseDistanceMatrixParameter.ActualValue); 75 } else 76 return null; 77 } else { 78 return parent1.Clone() as PrinsEncoding; 79 } 76 80 } 77 81 }
Note: See TracChangeset
for help on using the changeset viewer.