Changeset 6459 for trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Potvin/Manipulators
- Timestamp:
- 06/21/11 10:27:03 (13 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Potvin/Manipulators
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Potvin/Manipulators/PotvinManipulator.cs
r6449 r6459 35 35 } 36 36 37 public IValueParameter<BoolValue> AllowInfeasibleSolutions { 38 get { return (IValueParameter<BoolValue>)Parameters["AllowInfeasibleSolutions"]; } 39 } 40 41 [StorableHook(HookType.AfterDeserialization)] 42 private void AfterDeserialization() { 43 // BackwardsCompatibility3.3 44 #region Backwards compatible code (remove with 3.4) 45 if (!Parameters.ContainsKey("AllowInfeasibleSolutions")) { 46 Parameters.Add(new ValueParameter<BoolValue>("AllowInfeasibleSolutions", "Indicates if infeasible solutions should be allowed.", new BoolValue(false))); 47 } 48 #endregion 49 } 50 37 51 [StorableConstructor] 38 52 protected PotvinManipulator(bool deserializing) : base(deserializing) { } … … 42 56 public PotvinManipulator() { 43 57 Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator which should be used for stochastic manipulation operators.")); 58 Parameters.Add(new ValueParameter<BoolValue>("AllowInfeasibleSolutions", "Indicates if infeasible solutions should be allowed.", new BoolValue(false))); 44 59 } 45 60 … … 75 90 protected static bool FindInsertionPlace(PotvinEncoding individual, int city, int routeToAvoid, 76 91 DoubleArray dueTime, DoubleArray serviceTime, DoubleArray readyTime, DoubleArray demand, 77 DoubleValue capacity, DistanceMatrix distMatrix, 92 DoubleValue capacity, DistanceMatrix distMatrix, bool allowInfeasible, 78 93 out int route, out int place) { 79 94 return individual.FindInsertionPlace( 80 95 dueTime, serviceTime, readyTime, 81 96 demand, capacity, distMatrix, 82 city, routeToAvoid, out route, out place); 97 city, routeToAvoid, allowInfeasible, 98 out route, out place); 83 99 } 84 100 -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Potvin/Manipulators/PotvinOneLevelExchangeManipulator.cs
r6449 r6459 42 42 public static void Apply(IRandom random, PotvinEncoding individual, 43 43 DoubleArray dueTime, DoubleArray readyTime, DoubleArray serviceTime, DoubleArray demand, 44 DoubleValue capacity, DistanceMatrix distMatrix ) {44 DoubleValue capacity, DistanceMatrix distMatrix, bool allowInfeasible) { 45 45 int selectedIndex = SelectRandomTourBiasedByLength(random, individual); 46 46 Tour route1 = … … 53 53 if (FindInsertionPlace(individual, route1.Cities[i], selectedIndex, 54 54 dueTime, serviceTime, readyTime, demand, capacity, 55 distMatrix, 55 distMatrix, allowInfeasible, 56 56 out insertedRoute, out insertedPlace)) { 57 57 individual.Tours[insertedRoute].Cities.Insert(insertedPlace, route1.Cities[i]); … … 82 82 DoubleValue capacity = CapacityParameter.ActualValue; 83 83 84 Apply(random, individual, dueTime, readyTime, serviceTime, demand, capacity, distMatrix); 84 bool allowInfeasible = AllowInfeasibleSolutions.Value.Value; 85 86 Apply(random, individual, dueTime, readyTime, serviceTime, demand, capacity, distMatrix, allowInfeasible); 85 87 } 86 88 } -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Potvin/Manipulators/PotvinTwoLevelExchangeManipulator.cs
r6449 r6459 39 39 public static void Apply(IRandom random, PotvinEncoding individual, 40 40 DoubleArray dueTime, DoubleArray readyTime, DoubleArray serviceTime, DoubleArray demand, 41 DoubleValue capacity, DistanceMatrix distMatrix ) {41 DoubleValue capacity, DistanceMatrix distMatrix, bool allowInfeasible) { 42 42 int selectedIndex = SelectRandomTourBiasedByLength(random, individual); 43 43 Tour route1 = individual.Tours[selectedIndex]; … … 61 61 customer2, selectedIndex, 62 62 dueTime, serviceTime, readyTime, demand, capacity, 63 distMatrix, 63 distMatrix, allowInfeasible, 64 64 out routeIdx, out place)) { 65 65 individual.Tours[routeIdx].Cities.Insert(place, customer2); … … 100 100 DoubleValue capacity = CapacityParameter.ActualValue; 101 101 102 Apply(random, individual, dueTime, readyTime, serviceTime, demand, capacity, distMatrix); 102 bool allowInfeasible = AllowInfeasibleSolutions.Value.Value; 103 104 Apply(random, individual, dueTime, readyTime, serviceTime, demand, capacity, distMatrix, allowInfeasible); 103 105 } 104 106 }
Note: See TracChangeset
for help on using the changeset viewer.