Changeset 17698 for branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/GVR/Crossovers
- Timestamp:
- 07/24/20 00:58:42 (4 years ago)
- File:
-
- 1 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();
Note: See TracChangeset
for help on using the changeset viewer.