Changeset 6760 for branches/PersistenceSpeedUp/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Prins
- Timestamp:
- 09/14/11 13:59:25 (13 years ago)
- Location:
- branches/PersistenceSpeedUp
- Files:
-
- 4 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 } -
branches/PersistenceSpeedUp/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Prins/PrinsEncoding.cs
r5445 r6760 76 76 List<Tour> result = new List<Tour>(); 77 77 78 DistanceMatrix distMatrix = VRPUtilities.GetDistanceMatrix(coordinates, distanceMatrix, useDistanceMatrix); 79 78 80 //Split permutation into vector P 79 81 int[] P = new int[cities + 1]; … … 84 86 V[0] = 0; 85 87 for (int i = 1; i <= cities; i++) { 86 V[i] = int.MaxValue;88 V[i] = double.MaxValue; 87 89 } 88 90 … … 106 108 overloadPenalty, 107 109 tardinessPenalty, 108 coordinates, 109 distanceMatrix, 110 useDistanceMatrix); 110 distMatrix); 111 111 112 112 double cost = eval.Quality;
Note: See TracChangeset
for help on using the changeset viewer.