- Timestamp:
- 08/19/10 16:51:30 (14 years ago)
- Location:
- branches/VRP/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/AlbaEncoding.cs
r4230 r4268 31 31 [Item("AlbaEncoding", "Represents an Alba encoding of VRP solutions. It is implemented as described in Alba, E. and Dorronsoro, B. (2004). Solving the Vehicle Routing Problem by Using Cellular Genetic Algorithms.")] 32 32 [StorableClass] 33 public class AlbaEncoding : Permutation , IVRPEncoding {33 public class AlbaEncoding : PermutationEncoding { 34 34 [Storable] 35 35 private int cities; 36 36 37 37 #region IVRPEncoding Members 38 public List<Tour> GetTours() {38 public override List<Tour> GetTours(ILookupParameter<DoubleMatrix> distanceMatrix = null, int maxVehicles = int.MaxValue) { 39 39 List<Tour> result = new List<Tour>(); 40 40 … … 78 78 79 79 public AlbaEncoding(Permutation permutation, int cities) 80 : base(PermutationTypes.RelativeUndirected) { 81 this.array = new int[permutation.Length]; 82 for (int i = 0; i < array.Length; i++) 83 this.array[i] = permutation[i]; 84 80 : base(permutation) { 85 81 this.cities = cities; 86 82 } … … 88 84 [StorableConstructor] 89 85 private AlbaEncoding(bool serializing) 90 : base( ) {86 : base(serializing) { 91 87 } 92 88 93 public static AlbaEncoding ConvertFrom(IVRPEncoding encoding, int vehicles ) {94 List<Tour> tours = encoding.GetTours( );89 public static AlbaEncoding ConvertFrom(IVRPEncoding encoding, int vehicles, ILookupParameter<DoubleMatrix> distanceMatrix) { 90 List<Tour> tours = encoding.GetTours(distanceMatrix, vehicles); 95 91 96 92 int cities = 0; … … 155 151 156 152 internal static void RemoveUnusedParameters(ParameterCollection parameters) { 157 parameters.Remove("DistanceMatrix");158 153 parameters.Remove("UseDistanceMatrix"); 159 154 parameters.Remove("Capacity"); -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Crossovers/AlbaCrossover.cs
r4206 r4268 53 53 54 54 if (!(solution is AlbaEncoding)) { 55 parents[i] = AlbaEncoding.ConvertFrom(solution, VehiclesParameter.ActualValue.Value); 55 parents[i] = AlbaEncoding.ConvertFrom(solution, VehiclesParameter.ActualValue.Value, 56 DistanceMatrixParameter); 56 57 } else { 57 58 parents[i] = solution; -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Manipulators/AlbaManipulator.cs
r4206 r4268 62 62 IVRPEncoding solution = VRPToursParameter.ActualValue; 63 63 if (!(solution is AlbaEncoding)) { 64 VRPToursParameter.ActualValue = AlbaEncoding.ConvertFrom(solution, VehiclesParameter.ActualValue.Value );64 VRPToursParameter.ActualValue = AlbaEncoding.ConvertFrom(solution, VehiclesParameter.ActualValue.Value, DistanceMatrixParameter); 65 65 } 66 66 -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/AlbaMoveOperator.cs
r4204 r4268 41 41 IVRPEncoding solution = VRPToursParameter.ActualValue; 42 42 if (!(solution is AlbaEncoding)) { 43 VRPToursParameter.ActualValue = AlbaEncoding.ConvertFrom(solution, VehiclesParameter.ActualValue.Value); 43 VRPToursParameter.ActualValue = AlbaEncoding.ConvertFrom(solution, VehiclesParameter.ActualValue.Value, 44 DistanceMatrixParameter); 44 45 } 45 46 -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/IntraRouteInversion/IntraRouteInversionEvaluator.cs
r4206 r4268 44 44 45 45 public static TourEvaluation GetMoveQuality(AlbaEncoding individual, IntraRouteInversionMove move, 46 IntValue vehicles, 46 47 DoubleArray dueTimeArray, DoubleArray serviceTimeArray, DoubleArray readyTimeArray, 47 48 DoubleArray demandArray, DoubleValue capacity, DoubleMatrix coordinates, … … 53 54 54 55 return VRPEvaluator.Evaluate( 55 newSolution, dueTimeArray, serviceTimeArray, readyTimeArray,56 newSolution, vehicles, dueTimeArray, serviceTimeArray, readyTimeArray, 56 57 demandArray, capacity, fleetUsageFactor, timeFactor, distanceFactor, 57 58 overloadPenalty, tardinessPenalty, coordinates, distanceMatrix, useDistanceMatrix); … … 61 62 return GetMoveQuality( 62 63 VRPToursParameter.ActualValue as AlbaEncoding, IntraRouteInversionMoveParameter.ActualValue, 64 VehiclesParameter.ActualValue, 63 65 DueTimeParameter.ActualValue, ServiceTimeParameter.ActualValue, ReadyTimeParameter.ActualValue, 64 66 DemandParameter.ActualValue, CapacityParameter.ActualValue, CoordinatesParameter.ActualValue, -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/IntraRouteInversion/IntraRouteInversionMove.cs
r4206 r4268 57 57 58 58 public TourEvaluation GetMoveQuality( 59 IVRPEncoding individual, 59 IVRPEncoding individual, IntValue vehicles, 60 60 DoubleArray dueTimeArray, DoubleArray serviceTimeArray, DoubleArray readyTimeArray, 61 61 DoubleArray demandArray, DoubleValue capacity, DoubleMatrix coordinates, … … 63 63 DoubleValue overloadPenalty, DoubleValue tardinessPenalty, 64 64 ILookupParameter<DoubleMatrix> distanceMatrix, Data.BoolValue useDistanceMatrix) { 65 return IntraRouteInversionMoveEvaluator.GetMoveQuality(individual as AlbaEncoding, this, 65 return IntraRouteInversionMoveEvaluator.GetMoveQuality(individual as AlbaEncoding, this, vehicles, 66 66 dueTimeArray, serviceTimeArray, readyTimeArray, demandArray, capacity, 67 67 coordinates, fleetUsageFactor, timeFactor, distanceFactor, -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/LambdaInterchange/LambdaInterchangeMove.cs
r4206 r4268 89 89 90 90 public TourEvaluation GetMoveQuality( 91 IVRPEncoding individual, 91 IVRPEncoding individual, IntValue vehicles, 92 92 DoubleArray dueTimeArray, DoubleArray serviceTimeArray, DoubleArray readyTimeArray, 93 93 DoubleArray demandArray, DoubleValue capacity, DoubleMatrix coordinates, … … 95 95 DoubleValue overloadPenalty, DoubleValue tardinessPenalty, 96 96 ILookupParameter<DoubleMatrix> distanceMatrix, Data.BoolValue useDistanceMatrix) { 97 return LambdaInterchangeMoveEvaluator.GetMoveQuality(individual as AlbaEncoding, this, 97 return LambdaInterchangeMoveEvaluator.GetMoveQuality(individual as AlbaEncoding, this, vehicles, 98 98 dueTimeArray, serviceTimeArray, readyTimeArray, demandArray, capacity, 99 99 coordinates, fleetUsageFactor, timeFactor, distanceFactor, -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/LambdaInterchange/LambdaInterchangeMoveEvaluator.cs
r4206 r4268 44 44 45 45 public static TourEvaluation GetMoveQuality(AlbaEncoding individual, LambdaInterchangeMove move, 46 IntValue vehicles, 46 47 DoubleArray dueTimeArray, DoubleArray serviceTimeArray, DoubleArray readyTimeArray, 47 48 DoubleArray demandArray, DoubleValue capacity, DoubleMatrix coordinates, … … 53 54 54 55 return VRPEvaluator.Evaluate( 55 newSolution, dueTimeArray, serviceTimeArray, readyTimeArray,56 newSolution, vehicles, dueTimeArray, serviceTimeArray, readyTimeArray, 56 57 demandArray, capacity, fleetUsageFactor, timeFactor, distanceFactor, 57 58 overloadPenalty, tardinessPenalty, coordinates, distanceMatrix, useDistanceMatrix); … … 61 62 return GetMoveQuality( 62 63 VRPToursParameter.ActualValue as AlbaEncoding, LambdaInterchangeMoveParameter.ActualValue, 64 VehiclesParameter.ActualValue, 63 65 DueTimeParameter.ActualValue, ServiceTimeParameter.ActualValue, ReadyTimeParameter.ActualValue, 64 66 DemandParameter.ActualValue, CapacityParameter.ActualValue, CoordinatesParameter.ActualValue, -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/ThreeOpt/PermutationTranslocationMoveEvaluator.cs
r4208 r4268 51 51 return VRPEvaluator.Evaluate( 52 52 newSolution, 53 VehiclesParameter.ActualValue, 53 54 DueTimeParameter.ActualValue, ServiceTimeParameter.ActualValue, ReadyTimeParameter.ActualValue, 54 55 DemandParameter.ActualValue, CapacityParameter.ActualValue,
Note: See TracChangeset
for help on using the changeset viewer.