Changeset 6909 for branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/VehicleAssignment
- Timestamp:
- 10/12/11 15:45:48 (13 years ago)
- Location:
- branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/VehicleAssignment
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/VehicleAssignment/PotvinVehicleAssignmentMultiMoveGenerator.cs
r6857 r6909 64 64 65 65 for (int i = 0; i < SampleSizeParameter.ActualValue.Value; i++) { 66 result.Add(PotvinVehicleAssignmentSingleMoveGenerator.Apply(individual, ProblemInstance, RandomParameter.ActualValue)); 66 var move = PotvinVehicleAssignmentSingleMoveGenerator.Apply(individual, ProblemInstance, RandomParameter.ActualValue); 67 if(move != null) 68 result.Add(move); 67 69 } 68 70 -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/VehicleAssignment/PotvinVehicleAssignmentSingleMoveGenerator.cs
r6857 r6909 65 65 66 66 public static PotvinVehicleAssignmentMove Apply(PotvinEncoding individual, IVRPProblemInstance problemInstance, IRandom rand) { 67 int tour1 = rand.Next(individual.Tours.Count); 68 int tour2 = rand.Next(problemInstance.Vehicles.Value); 67 if (individual.Tours.Count > 1) { 68 int tour1 = rand.Next(individual.Tours.Count); 69 int tour2 = rand.Next(problemInstance.Vehicles.Value); 69 70 70 while (tour2 == tour1)71 tour2 = rand.Next(problemInstance.Vehicles.Value);71 while (tour2 == tour1) 72 tour2 = rand.Next(problemInstance.Vehicles.Value); 72 73 73 return new PotvinVehicleAssignmentMove(tour1, tour2, individual); 74 return new PotvinVehicleAssignmentMove(tour1, tour2, individual); 75 } else { 76 return null; 77 } 74 78 } 75 79
Note: See TracChangeset
for help on using the changeset viewer.