Changeset 17698 for branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/GVR
- Timestamp:
- 07/24/20 00:58:42 (5 years ago)
- Location:
- branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/GVR
- Files:
-
- 1 added
- 1 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/GVR/Crossovers/GVRCrossover.cs
r17226 r17698 52 52 } 53 53 54 private GVREncod ing Crossover(IRandom random, GVREncoding parent1, GVREncodingparent2) {55 GVREncod ing child = parent1.Clone() as GVREncoding;54 private GVREncodedSolution Crossover(IRandom random, GVREncodedSolution parent1, GVREncodedSolution parent2) { 55 GVREncodedSolution child = parent1.Clone() as GVREncodedSolution; 56 56 57 57 Tour tour = parent2.Tours[random.Next(parent2.Tours.Count)]; … … 97 97 } else { 98 98 //special case -> only one tour, whole tour has been chosen as subroute 99 child = parent1.Clone() as GVREncod ing;99 child = parent1.Clone() as GVREncodedSolution; 100 100 } 101 101 … … 104 104 105 105 public override IOperation InstrumentedApply() { 106 ItemArray<IVRPEncod ing> parents = new ItemArray<IVRPEncoding>(ParentsParameter.ActualValue.Length);106 ItemArray<IVRPEncodedSolution> parents = new ItemArray<IVRPEncodedSolution>(ParentsParameter.ActualValue.Length); 107 107 for (int i = 0; i < ParentsParameter.ActualValue.Length; i++) { 108 IVRPEncod ingsolution = ParentsParameter.ActualValue[i];109 if (!(solution is GVREncod ing)) {110 parents[i] = GVREncod ing.ConvertFrom(solution, ProblemInstance);108 IVRPEncodedSolution solution = ParentsParameter.ActualValue[i]; 109 if (!(solution is GVREncodedSolution)) { 110 parents[i] = GVREncodedSolution.ConvertFrom(solution, ProblemInstance); 111 111 } else { 112 112 parents[i] = solution; … … 115 115 ParentsParameter.ActualValue = parents; 116 116 117 ChildParameter.ActualValue = Crossover(RandomParameter.ActualValue, parents[0] as GVREncod ing, parents[1] as GVREncoding);117 ChildParameter.ActualValue = Crossover(RandomParameter.ActualValue, parents[0] as GVREncodedSolution, parents[1] as GVREncodedSolution); 118 118 119 119 return base.InstrumentedApply(); -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/GVR/Manipulators/GVRDisplacementManipulator.cs
r17226 r17698 44 44 } 45 45 46 protected override void Manipulate(IRandom random, GVREncod ingindividual) {46 protected override void Manipulate(IRandom random, GVREncodedSolution individual) { 47 47 Tour tour = individual.Tours[random.Next(individual.Tours.Count)]; 48 48 int breakPoint1 = random.Next(tour.Stops.Count); -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/GVR/Manipulators/GVRInsertionManipulator.cs
r17226 r17698 43 43 } 44 44 45 protected override void Manipulate(IRandom random, GVREncod ingindividual) {45 protected override void Manipulate(IRandom random, GVREncodedSolution individual) { 46 46 int customer = random.Next(1, individual.Cities + 1); 47 47 Tour tour; -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/GVR/Manipulators/GVRInversionManipulator.cs
r17226 r17698 43 43 } 44 44 45 protected override void Manipulate(IRandom random, GVREncod ingindividual) {45 protected override void Manipulate(IRandom random, GVREncodedSolution individual) { 46 46 Tour tour = individual.Tours[random.Next(individual.Tours.Count)]; 47 47 int breakPoint1 = random.Next(tour.Stops.Count); -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/GVR/Manipulators/GVRManipulator.cs
r17226 r17698 47 47 } 48 48 49 protected abstract void Manipulate(IRandom random, GVREncod ingindividual);49 protected abstract void Manipulate(IRandom random, GVREncodedSolution individual); 50 50 51 51 public override IOperation InstrumentedApply() { 52 IVRPEncod ingsolution = VRPToursParameter.ActualValue;53 if (!(solution is GVREncod ing)) {54 VRPToursParameter.ActualValue = GVREncod ing.ConvertFrom(solution, ProblemInstance);52 IVRPEncodedSolution solution = VRPToursParameter.ActualValue; 53 if (!(solution is GVREncodedSolution)) { 54 VRPToursParameter.ActualValue = GVREncodedSolution.ConvertFrom(solution, ProblemInstance); 55 55 } 56 56 57 Manipulate(RandomParameter.ActualValue, VRPToursParameter.ActualValue as GVREncod ing);57 Manipulate(RandomParameter.ActualValue, VRPToursParameter.ActualValue as GVREncodedSolution); 58 58 59 59 return base.InstrumentedApply(); -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/GVR/Manipulators/GVRSwapManipulator.cs
r17226 r17698 43 43 } 44 44 45 protected override void Manipulate(IRandom random, GVREncod ingindividual) {45 protected override void Manipulate(IRandom random, GVREncodedSolution individual) { 46 46 int customer1 = random.Next(1, individual.Cities + 1); 47 47 int customer2 = random.Next(1, individual.Cities + 1);
Note: See TracChangeset
for help on using the changeset viewer.