Changeset 6618 for branches/GP.Grammar.Editor/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Potvin/Crossovers/PotvinSequenceBasedCrossover.cs
- Timestamp:
- 08/01/11 17:48:53 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GP.Grammar.Editor/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Potvin/Crossovers/PotvinSequenceBasedCrossover.cs
r5445 r6618 23 23 using HeuristicLab.Core; 24 24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 25 using HeuristicLab.Data; 25 26 26 27 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin { … … 41 42 42 43 protected override PotvinEncoding Crossover(IRandom random, PotvinEncoding parent1, PotvinEncoding parent2) { 44 BoolValue useDistanceMatrix = UseDistanceMatrixParameter.ActualValue; 45 DoubleMatrix coordinates = CoordinatesParameter.ActualValue; 46 DistanceMatrix distMatrix = VRPUtilities.GetDistanceMatrix(coordinates, DistanceMatrixParameter, useDistanceMatrix); 47 DoubleArray dueTime = DueTimeParameter.ActualValue; 48 DoubleArray readyTime = ReadyTimeParameter.ActualValue; 49 DoubleArray serviceTime = ServiceTimeParameter.ActualValue; 50 DoubleArray demand = DemandParameter.ActualValue; 51 DoubleValue capacity = CapacityParameter.ActualValue; 52 53 bool allowInfeasible = AllowInfeasibleSolutions.Value.Value; 54 43 55 PotvinEncoding child = parent1.Clone() as PotvinEncoding; 44 56 Tour newTour = new Tour(); … … 69 81 child.Unrouted.Add(city); 70 82 71 if (Feasible(newTour) && 72 Repair(random, child, newTour)) { 83 if (Repair(random, child, newTour, distMatrix, dueTime, readyTime, serviceTime, demand, capacity, allowInfeasible) || allowInfeasible) { 73 84 return child; 74 85 } else { 75 if (random.NextDouble() < 0.5)86 if (random.NextDouble() < 0.5) 76 87 return parent1.Clone() as PotvinEncoding; 77 88 else 78 return parent2.Clone() as PotvinEncoding; 89 return parent2.Clone() as PotvinEncoding; 79 90 } 80 91 }
Note: See TracChangeset
for help on using the changeset viewer.