- Timestamp:
- 07/27/12 15:21:20 (12 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Crossovers
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Crossovers/PotvinCrossover.cs
r8053 r8346 63 63 } 64 64 65 protected Tour FindRoute(PotvinEncoding solution, int city) {65 protected static Tour FindRoute(PotvinEncoding solution, int city) { 66 66 Tour found = null; 67 67 -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Crossovers/PotvinRouteBasedCrossover.cs
r8053 r8346 24 24 using HeuristicLab.Encodings.PermutationEncoding; 25 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 using HeuristicLab.Problems.VehicleRouting.Interfaces; 26 27 27 28 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin { … … 43 44 } 44 45 45 protected override PotvinEncoding Crossover(IRandom random, PotvinEncoding parent1, PotvinEncoding parent2) { 46 bool allowInfeasible = AllowInfeasibleSolutions.Value.Value; 47 46 public static PotvinEncoding Apply(IRandom random, PotvinEncoding parent1, PotvinEncoding parent2, IVRPProblemInstance problemInstance, bool allowInfeasible) { 48 47 PotvinEncoding child = parent2.Clone() as PotvinEncoding; 49 48 … … 75 74 child.Unrouted.Add(city); 76 75 77 if (Repair(random, child, replacing, ProblemInstance, allowInfeasible) || allowInfeasible)76 if (Repair(random, child, replacing, problemInstance, allowInfeasible) || allowInfeasible) 78 77 return child; 79 78 else { … … 87 86 } 88 87 } 88 89 protected override PotvinEncoding Crossover(IRandom random, PotvinEncoding parent1, PotvinEncoding parent2) { 90 return Apply(random, parent1, parent2, ProblemInstance, AllowInfeasibleSolutions.Value.Value); 91 } 89 92 } 90 93 } -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Crossovers/PotvinSequenceBasedCrossover.cs
r8053 r8346 23 23 using HeuristicLab.Core; 24 24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 25 using HeuristicLab.Problems.VehicleRouting.Interfaces; 25 26 26 27 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin { … … 42 43 } 43 44 44 protected override PotvinEncoding Crossover(IRandom random, PotvinEncoding parent1, PotvinEncoding parent2) { 45 bool allowInfeasible = AllowInfeasibleSolutions.Value.Value; 46 45 public static PotvinEncoding Apply(IRandom random, PotvinEncoding parent1, PotvinEncoding parent2, IVRPProblemInstance problemInstance, bool allowInfeasible) { 47 46 PotvinEncoding child = parent1.Clone() as PotvinEncoding; 48 47 Tour newTour = new Tour(); 49 48 50 int cities = ProblemInstance.Cities.Value;49 int cities = problemInstance.Cities.Value; 51 50 52 51 if (cities > 0) { … … 77 76 child.Unrouted.Add(city); 78 77 79 if (Repair(random, child, newTour, ProblemInstance, allowInfeasible) || allowInfeasible) {78 if (Repair(random, child, newTour, problemInstance, allowInfeasible) || allowInfeasible) { 80 79 return child; 81 80 } else { … … 89 88 } 90 89 } 90 91 protected override PotvinEncoding Crossover(IRandom random, PotvinEncoding parent1, PotvinEncoding parent2) { 92 return Apply(random, parent1, parent2, ProblemInstance, AllowInfeasibleSolutions.Value.Value); 93 } 91 94 } 92 95 }
Note: See TracChangeset
for help on using the changeset viewer.