Changeset 6607 for branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Manipulators
- Timestamp:
- 07/28/11 14:16:21 (13 years ago)
- Location:
- branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Manipulators
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Manipulators/PotvinManipulator.cs
r4752 r6607 38 38 } 39 39 40 public IValueParameter<BoolValue> AllowInfeasibleSolutions { 41 get { return (IValueParameter<BoolValue>)Parameters["AllowInfeasibleSolutions"]; } 42 } 43 40 44 [StorableConstructor] 41 45 protected PotvinManipulator(bool deserializing) : base(deserializing) { } … … 43 47 public PotvinManipulator() { 44 48 Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator which should be used for stochastic manipulation operators.")); 49 Parameters.Add(new ValueParameter<BoolValue>("AllowInfeasibleSolutions", "Indicates if infeasible solutions should be allowed.", new BoolValue(false))); 45 50 } 46 51 … … 78 83 } 79 84 80 protected bool FindInsertionPlace(PotvinEncoding individual, int city, int routeToAvoid, out int route, out int place) {85 protected bool FindInsertionPlace(PotvinEncoding individual, int city, int routeToAvoid, bool allowInfeasible, out int route, out int place) { 81 86 return individual.FindInsertionPlace( 82 city, routeToAvoid, out route, out place);87 city, routeToAvoid, allowInfeasible, out route, out place); 83 88 } 84 89 -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Manipulators/PotvinOneLevelExchangeManipulator.cs
r4752 r6607 46 46 47 47 protected override void Manipulate(IRandom random, PotvinEncoding individual) { 48 bool allowInfeasible = AllowInfeasibleSolutions.Value.Value; 49 48 50 int selectedIndex = SelectRandomTourBiasedByLength(random, individual); 49 51 Tour route1 = … … 54 56 int insertedRoute, insertedPlace; 55 57 56 if (FindInsertionPlace(individual, route1.Stops[i], selectedIndex, out insertedRoute, out insertedPlace)) {58 if (FindInsertionPlace(individual, route1.Stops[i], selectedIndex, allowInfeasible, out insertedRoute, out insertedPlace)) { 57 59 individual.Tours[insertedRoute].Stops.Insert(insertedPlace, route1.Stops[i]); 58 60 replaced.Add(route1.Stops[i]); -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Manipulators/PotvinTwoLevelExchangeManipulator.cs
r5867 r6607 46 46 47 47 protected override void Manipulate(IRandom random, PotvinEncoding individual) { 48 bool allowInfeasible = AllowInfeasibleSolutions.Value.Value; 49 48 50 int selectedIndex = SelectRandomTourBiasedByLength(random, individual); 49 51 Tour route1 = individual.Tours[selectedIndex]; … … 65 67 int routeIdx, place; 66 68 if (FindInsertionPlace(individual, 67 customer2, selectedIndex, out routeIdx, out place)) {69 customer2, selectedIndex, allowInfeasible, out routeIdx, out place)) { 68 70 individual.Tours[routeIdx].Stops.Insert(place, customer2); 69 71 route1.Stops.RemoveAt(customer1Position);
Note: See TracChangeset
for help on using the changeset viewer.