- Timestamp:
- 08/10/10 17:40:41 (14 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Potvin
- Files:
-
- 3 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Potvin/Crossovers/PotvinCrossover.cs
r4179 r4186 51 51 DistanceMatrixParameter, UseDistanceMatrixParameter.ActualValue, 52 52 city, -1, out route, out place); 53 } 54 55 protected Tour FindRoute(PotvinEncoding solution, int city) { 56 Tour found = null; 57 58 foreach (Tour tour in solution.Tours) { 59 if (tour.Cities.Contains(city)) { 60 found = tour; 61 break; 62 } 63 } 64 65 return found; 53 66 } 54 67 -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Potvin/Crossovers/SequenceBasedCrossover.cs
r4179 r4186 35 35 public SequenceBasedCrossover() 36 36 : base() { } 37 38 private Tour FindRoute(PotvinEncoding solution, int city) { 39 Tour found = null; 40 41 foreach (Tour tour in solution.Tours) { 42 if (tour.Cities.Contains(city)) { 43 found = tour; 44 break; 45 } 46 } 47 48 return found; 49 } 50 37 51 38 protected override PotvinEncoding Crossover(IRandom random, PotvinEncoding parent1, PotvinEncoding parent2) { 52 39 PotvinEncoding child = parent1.Clone() as PotvinEncoding; … … 78 65 child.Unrouted.Add(city); 79 66 80 if (Repair(random, child, newTour)) 67 if (Feasible(newTour) && 68 Repair(random, child, newTour)) { 81 69 return child; 82 else {83 if (random.NextDouble() < 0.5)70 } else { 71 if (random.NextDouble() < 0.5) 84 72 return parent1.Clone() as PotvinEncoding; 85 73 else -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Potvin/Manipulators/TwoLevelExchangeManipulator.cs
r4179 r4186 28 28 29 29 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin { 30 [Item("TwoLevelExchange Operator", "The 2M operator which manipulates a Potvin VRP representation. It is implemented as described in Potvin, J.-Y. and Bengio, S. (1996). The Vehicle Routing Problem with Time Windows - Part II: Genetic Search. INFORMS Journal of Computing, 8:165–172.")]30 [Item("TwoLevelExchangeManipulator", "The 2M operator which manipulates a Potvin VRP representation. It is implemented as described in Potvin, J.-Y. and Bengio, S. (1996). The Vehicle Routing Problem with Time Windows - Part II: Genetic Search. INFORMS Journal of Computing, 8:165–172.")] 31 31 [StorableClass] 32 public sealed class TwoLevelExchange Operator : PotvinManipulator {32 public sealed class TwoLevelExchangeManipulator : PotvinManipulator { 33 33 [StorableConstructor] 34 private TwoLevelExchange Operator(bool deserializing) : base(deserializing) { }34 private TwoLevelExchangeManipulator(bool deserializing) : base(deserializing) { } 35 35 36 public TwoLevelExchange Operator(): base() { }36 public TwoLevelExchangeManipulator() : base() { } 37 37 38 38 protected override void Manipulate(IRandom random, PotvinEncoding individual) {
Note: See TracChangeset
for help on using the changeset viewer.