Changeset 14650 for branches/PersistentDataStructures/HeuristicLab.Problems.VehicleRouting/3.4/Encodings
- Timestamp:
- 02/07/17 14:05:09 (8 years ago)
- Location:
- branches/PersistentDataStructures/HeuristicLab.Problems.VehicleRouting/3.4/Encodings
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PersistentDataStructures/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Alba/AlbaEncoding.cs
r14186 r14650 40 40 41 41 Tour tour = new Tour(); 42 for (int i = 0; i < this. array.Length; i++) {43 if (this. array[i] >= cities) {42 for (int i = 0; i < this.historyArray.Length; i++) { 43 if (this.historyArray[i] >= cities) { 44 44 if (tour.Stops.Count > 0) { 45 45 result.Add(tour); … … 48 48 } 49 49 } else { 50 tour.Stops.Add(this. array[i] + 1);50 tour.Stops.Add(this.historyArray[i] + 1); 51 51 } 52 52 } … … 72 72 73 73 while (vehicleAssignment == -1) { 74 if (this. array[i] >= ProblemInstance.Cities.Value) {75 vehicleAssignment = this. array[i] - ProblemInstance.Cities.Value;74 if (this.historyArray[i] >= ProblemInstance.Cities.Value) { 75 vehicleAssignment = this.historyArray[i] - ProblemInstance.Cities.Value; 76 76 } 77 77 -
branches/PersistentDataStructures/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/General/PermutationEncoding.cs
r14186 r14650 24 24 using HeuristicLab.Common; 25 25 using HeuristicLab.Core; 26 using HeuristicLab.Data.PersistentDataStructures.Adaptations; 26 27 using HeuristicLab.Encodings.PermutationEncoding; 27 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 69 70 public PermutationEncoding(Permutation permutation, IVRPProblemInstance problemInstance) 70 71 : base(PermutationTypes.RelativeUndirected) { 71 this. array = new int[permutation.Length];72 for (int i = 0; i < array.Length; i++)73 this. array[i] = permutation[i];72 this.historyArray = new HistoryArray<int>(permutation.Length); 73 for (int i = 0; i < historyArray.Length; i++) 74 this.historyArray[i] = permutation[i]; 74 75 75 76 this.ProblemInstance = problemInstance; … … 82 83 83 84 public int IndexOf(int city) { 84 return Array.IndexOf(this.array,city);85 return historyArray.IndexOf(city); 85 86 } 86 87 } -
branches/PersistentDataStructures/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Prins/PrinsEncoding.cs
r14186 r14650 102 102 103 103 //find predecessor / successor in permutation 104 int predecessorIndex = Array.IndexOf(this.array,tour.Stops[0] - 1) - 1;104 int predecessorIndex = historyArray.IndexOf(tour.Stops[0] - 1) - 1; 105 105 if (predecessorIndex >= 0) { 106 106 int predecessor = this[predecessorIndex] + 1; … … 114 114 } 115 115 } else { 116 int successorIndex = Array.IndexOf(this.array,116 int successorIndex = historyArray.IndexOf( 117 117 tour.Stops[tour.Stops.Count - 1] - 1) + 1; 118 118 int successor = this[successorIndex] + 1; -
branches/PersistentDataStructures/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Zhu/ZhuEncoding.cs
r14186 r14650 63 63 64 64 //find predecessor / successor in permutation 65 int predecessorIndex = Array.IndexOf(this.array,tour.Stops[0] - 1) - 1;65 int predecessorIndex = historyArray.IndexOf(tour.Stops[0] - 1) - 1; 66 66 if (predecessorIndex >= 0) { 67 67 int predecessor = this[predecessorIndex] + 1; … … 75 75 } 76 76 } else { 77 int successorIndex = Array.IndexOf(this.array,77 int successorIndex = historyArray.IndexOf( 78 78 tour.Stops[tour.Stops.Count - 1] - 1) + 1; 79 79 int successor = this[successorIndex] + 1;
Note: See TracChangeset
for help on using the changeset viewer.