Changeset 4268
- Timestamp:
- 08/19/10 16:51:30 (14 years ago)
- Location:
- branches/VRP
- Files:
-
- 15 added
- 25 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.3/VRPSolutionView.cs
r4230 r4268 27 27 using HeuristicLab.MainForm; 28 28 using HeuristicLab.Problems.VehicleRouting.Encodings; 29 using HeuristicLab.Parameters; 29 30 30 31 namespace HeuristicLab.Problems.VehicleRouting.Views { … … 119 120 if (Content.Solution != null) { 120 121 int currentTour = 0; 121 foreach (Tour tour in Content.Solution.GetTours( )) {122 foreach (Tour tour in Content.Solution.GetTours(new ValueLookupParameter<DoubleMatrix>("DistanceMatrix", distanceMatrix))) { 122 123 double t = 0.0; 123 124 Point[] tourPoints = new Point[tour.Cities.Count + 2]; -
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, -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/GVR/Crossovers/GVRCrossover.cs
r4230 r4268 104 104 for (int i = 0; i < ParentsParameter.ActualValue.Length; i++) { 105 105 IVRPEncoding solution = ParentsParameter.ActualValue[i]; 106 107 106 if (!(solution is GVREncoding)) { 108 parents[i] = GVREncoding.ConvertFrom(solution, CapacityParameter.ActualValue, DemandParameter.ActualValue, 109 VehiclesParameter.ActualValue);107 parents[i] = GVREncoding.ConvertFrom(solution, CapacityParameter.ActualValue, DemandParameter.ActualValue, 108 DistanceMatrixParameter); 110 109 } else { 111 110 parents[i] = solution; -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/GVR/GVREncoding.cs
r4230 r4268 37 37 38 38 [Storable] 39 private IntValue vehicles { get; set; }40 41 [Storable]42 39 private DoubleArray demand { get; set; } 43 40 44 public override List<Tour> GetTours( ) {41 public override List<Tour> GetTours(ILookupParameter<DoubleMatrix> distanceMatrix = null, int maxVehicles = int.MaxValue) { 45 42 List<Tour> tours = new List<Tour>(); 43 Tour newTour = new Tour(); 44 double currentDemand = 0; 46 45 47 46 int toursProcessed = 0; 48 47 foreach (Tour tour in base.Tours) { 49 Tour newTour = new Tour(); 50 double currentDemand = 0; 48 if (maxVehicles > tours.Count) { 49 newTour = new Tour(); 50 currentDemand = 0; 51 } 51 52 52 53 foreach (int city in tour.Cities) { 53 54 currentDemand += demand[city]; 54 55 55 if ( vehicles.Value > tours.Count + base.Tours.Count - toursProcessed&&56 if (maxVehicles > tours.Count && 56 57 currentDemand > capacity.Value) { 57 58 if(newTour.Cities.Count > 0) … … 66 67 } 67 68 68 if (newTour.Cities.Count > 0) 69 if (newTour.Cities.Count > 0 && 70 maxVehicles > tours.Count) 69 71 tours.Add(newTour); 72 70 73 toursProcessed++; 71 74 } … … 75 78 76 79 public override IDeepCloneable Clone(HeuristicLab.Common.Cloner cloner) { 77 GVREncoding clone = new GVREncoding(capacity, demand , vehicles);80 GVREncoding clone = new GVREncoding(capacity, demand); 78 81 cloner.RegisterClonedObject(this, clone); 79 82 clone.Tours = (ItemList<Tour>)cloner.Clone(this.Tours); … … 82 85 } 83 86 84 public GVREncoding(DoubleValue capacity, DoubleArray demand , IntValue vehicles)87 public GVREncoding(DoubleValue capacity, DoubleArray demand) 85 88 : base() { 86 89 this.capacity = capacity; 87 90 this.demand = demand; 88 this.vehicles = vehicles;89 91 } 90 92 … … 94 96 } 95 97 96 public static GVREncoding ConvertFrom(IVRPEncoding encoding, DoubleValue capacity, DoubleArray demand, IntValue vehicles) { 97 GVREncoding solution = new GVREncoding(capacity, demand, vehicles); 98 public static GVREncoding ConvertFrom(IVRPEncoding encoding, DoubleValue capacity, DoubleArray demand, 99 ILookupParameter<DoubleMatrix> distanceMatrix) { 100 GVREncoding solution = new GVREncoding(capacity, demand); 98 101 99 TourEncoding.ConvertFrom(encoding, solution );102 TourEncoding.ConvertFrom(encoding, solution, distanceMatrix); 100 103 101 104 return solution; 102 105 } 103 106 104 public static GVREncoding ConvertFrom(List<int> route, DoubleValue capacity, DoubleArray demand , IntValue vehicles) {105 GVREncoding solution = new GVREncoding(capacity, demand , vehicles);107 public static GVREncoding ConvertFrom(List<int> route, DoubleValue capacity, DoubleArray demand) { 108 GVREncoding solution = new GVREncoding(capacity, demand); 106 109 107 110 TourEncoding.ConvertFrom(route, solution); -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/GVR/Manipulators/GVRManipulator.cs
r4230 r4268 43 43 //remove unused parameters 44 44 Parameters.Remove("Coordinates"); 45 Parameters.Remove("DistanceMatrix");46 45 Parameters.Remove("UseDistanceMatrix"); 47 46 Parameters.Remove("ReadyTime"); … … 56 55 if (!(solution is GVREncoding)) { 57 56 VRPToursParameter.ActualValue = GVREncoding.ConvertFrom(solution, CapacityParameter.ActualValue, DemandParameter.ActualValue, 58 VehiclesParameter.ActualValue);57 DistanceMatrixParameter); 59 58 } 60 59 -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/General/Moves/Interfaces/IVRPMove.cs
r4205 r4268 27 27 namespace HeuristicLab.Problems.VehicleRouting.Encodings.General { 28 28 public interface IVRPMove : IItem { 29 TourEvaluation GetMoveQuality(IVRPEncoding individual, 29 TourEvaluation GetMoveQuality(IVRPEncoding individual, IntValue vehicles, 30 30 DoubleArray dueTimeArray, DoubleArray serviceTimeArray, DoubleArray readyTimeArray, DoubleArray demandArray, 31 31 DoubleValue capacity,DoubleMatrix coordinates, -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/General/Moves/MultiVRPMoveOperator/MultiVRPMoveEvaluator.cs
r4205 r4268 47 47 return move.GetMoveQuality( 48 48 VRPToursParameter.ActualValue, 49 VehiclesParameter.ActualValue, 49 50 DueTimeParameter.ActualValue, 50 51 ServiceTimeParameter.ActualValue, -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/General/TourEncoding.cs
r4230 r4268 37 37 38 38 #region IVRPEncoding Members 39 public virtual List<Tour> GetTours() { 40 return new List<Tour>(Tours); 39 public virtual List<Tour> GetTours(ILookupParameter<DoubleMatrix> distanceMatrix = null, int maxVehicles = int.MaxValue) { 40 List<Tour> result = new List<Tour>(Tours); 41 42 while (result.Count > maxVehicles) { 43 Tour tour = result[result.Count - 1]; 44 result[result.Count - 2].Cities.AddRange(tour.Cities); 45 46 result.Remove(tour); 47 } 48 49 return result; 41 50 } 42 51 … … 66 75 : base() { 67 76 } 68 69 public static void ConvertFrom(IVRPEncoding encoding, TourEncoding solution ) {70 solution.Tours = new ItemList<Tour>(encoding.GetTours( ));77 78 public static void ConvertFrom(IVRPEncoding encoding, TourEncoding solution, ILookupParameter<DoubleMatrix> distanceMatrix) { 79 solution.Tours = new ItemList<Tour>(encoding.GetTours(distanceMatrix)); 71 80 } 72 81 -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Potvin/Crossovers/PotvinCrossover.cs
r4206 r4268 129 129 130 130 if (!(solution is PotvinEncoding)) { 131 parents[i] = PotvinEncoding.ConvertFrom(solution );131 parents[i] = PotvinEncoding.ConvertFrom(solution, DistanceMatrixParameter); 132 132 } else { 133 133 parents[i] = solution; -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Potvin/Manipulators/PotvinManipulator.cs
r4206 r4268 82 82 IVRPEncoding solution = VRPToursParameter.ActualValue; 83 83 if (!(solution is PotvinEncoding)) { 84 VRPToursParameter.ActualValue = PotvinEncoding.ConvertFrom(solution );84 VRPToursParameter.ActualValue = PotvinEncoding.ConvertFrom(solution, DistanceMatrixParameter); 85 85 } 86 86 -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Potvin/PotvinEncoding.cs
r4230 r4268 53 53 } 54 54 55 public static PotvinEncoding ConvertFrom(IVRPEncoding encoding ) {55 public static PotvinEncoding ConvertFrom(IVRPEncoding encoding, ILookupParameter<DoubleMatrix> distanceMatrix) { 56 56 PotvinEncoding solution = new PotvinEncoding(); 57 57 58 TourEncoding.ConvertFrom(encoding, solution );58 TourEncoding.ConvertFrom(encoding, solution, distanceMatrix); 59 59 60 60 return solution; -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.3/Evaluators/VRPEvaluator.cs
r4230 r4268 101 101 IVRPEncoding vrpSolution = VRPToursParameter.ActualValue; 102 102 103 return vrpSolution.GetTours( ).Count;103 return vrpSolution.GetTours(DistanceMatrixParameter, VehiclesParameter.ActualValue.Value).Count; 104 104 } 105 105 … … 178 178 } 179 179 180 public static TourEvaluation Evaluate(IVRPEncoding solution, DoubleArray dueTimeArray,180 public static TourEvaluation Evaluate(IVRPEncoding solution, IntValue vehicles, DoubleArray dueTimeArray, 181 181 DoubleArray serviceTimeArray, DoubleArray readyTimeArray, DoubleArray demandArray, DoubleValue capacity, 182 182 DoubleValue fleetUsageFactor, DoubleValue timeFactor, DoubleValue distanceFactor, DoubleValue overloadPenalty, DoubleValue tardinessPenalty, … … 190 190 sumEval.Tardiness = 0; 191 191 192 foreach (Tour tour in solution.GetTours( )) {192 foreach (Tour tour in solution.GetTours(distanceMatrix)) { 193 193 TourEvaluation eval = EvaluateTour(tour, dueTimeArray, serviceTimeArray, readyTimeArray, demandArray, capacity, 194 194 fleetUsageFactor, timeFactor, distanceFactor, overloadPenalty, tardinessPenalty, … … 208 208 IVRPEncoding solution = VRPToursParameter.ActualValue; 209 209 210 TourEvaluation sumEval = Evaluate(solution, DueTimeParameter.ActualValue, ServiceTimeParameter.ActualValue, ReadyTimeParameter.ActualValue,210 TourEvaluation sumEval = Evaluate(solution, VehiclesParameter.ActualValue, DueTimeParameter.ActualValue, ServiceTimeParameter.ActualValue, ReadyTimeParameter.ActualValue, 211 211 DemandParameter.ActualValue, CapacityParameter.ActualValue, 212 212 FleetUsageFactor.ActualValue, TimeFactor.ActualValue, DistanceFactor.ActualValue, OverloadPenalty.ActualValue, TardinessPenalty.ActualValue, -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.3/HeuristicLab.Problems.VehicleRouting-3.3.csproj
r4241 r4268 131 131 <Compile Include="Encodings\Alba\Moves\IntraRouteInversion\IntraRouteInversionMoveMaker.cs" /> 132 132 <Compile Include="Encodings\Alba\Moves\IntraRouteInversion\IntraRouteInversionMove.cs" /> 133 <Compile Include="Encodings\General\PermutationEncoding.cs" /> 133 134 <Compile Include="Encodings\General\Creators\MultiVRPCreator.cs" /> 134 <Compile Include="Encodings\General\ Crossovers\MultiVRPManipulator.cs" />135 <Compile Include="Encodings\General\Manipulators\MultiVRPManipulator.cs" /> 135 136 <Compile Include="Encodings\General\Crossovers\MultiVRPCrossover.cs" /> 136 137 <Compile Include="Encodings\General\Creators\RandomCreator.cs" /> … … 156 157 <Compile Include="Encodings\Potvin\Manipulators\OneLevelExchangeManipulator.cs" /> 157 158 <Compile Include="Encodings\Potvin\Manipulators\PotvinManipulator.cs" /> 159 <Compile Include="Encodings\Prins\Crossovers\PrinsCrossover.cs" /> 160 <Compile Include="Encodings\Prins\Crossovers\PrinsPermutationCrossover.cs" /> 161 <Compile Include="Encodings\Prins\Interfaces\IPrinsOperator.cs" /> 162 <Compile Include="Encodings\Prins\Manipulators\PrinsStochasticLSManipulator.cs" /> 163 <Compile Include="Encodings\Prins\Manipulators\PrinsExhaustiveLSManipulator.cs" /> 164 <Compile Include="Encodings\Prins\Manipulators\PrinsLSManipulator.cs" /> 165 <Compile Include="Encodings\Prins\Manipulators\PrinsManipulator.cs" /> 166 <Compile Include="Encodings\Prins\Manipulators\PrinsPermutationManipulator.cs" /> 167 <Compile Include="Encodings\Prins\PrinsEncoding.cs" /> 158 168 <Compile Include="Interfaces\IVRPMoveMaker.cs" /> 159 169 <Compile Include="TSPLIBParser.cs" /> -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.3/Interfaces/IVRPEncoding.cs
r4230 r4268 23 23 using HeuristicLab.Problems.VehicleRouting.Encodings; 24 24 using System.Collections.Generic; 25 using HeuristicLab.Data; 25 26 26 27 namespace HeuristicLab.Problems.VehicleRouting { 27 28 public interface IVRPEncoding : IItem { 28 List<Tour> GetTours( );29 List<Tour> GetTours(ILookupParameter<DoubleMatrix> distanceMatrix, int maxVehicles = int.MaxValue); 29 30 } 30 31 } -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.3/VRPOperator.cs
r4241 r4268 139 139 bool feasible = true; 140 140 141 foreach (Tour tour in solution.GetTours( )) {141 foreach (Tour tour in solution.GetTours(DistanceMatrixParameter)) { 142 142 if (!Feasible(tour)) { 143 143 feasible = false; -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.3/VRPUtilities.cs
r4154 r4268 60 60 61 61 if (useDistanceMatrix.Value) { 62 if (distanceMatrix.ActualValue == null) { 63 distanceMatrix.ActualValue = CreateDistanceMatrix(coordinates); 64 } 62 if (distanceMatrix is IValueLookupParameter<DoubleMatrix> && 63 (distanceMatrix as IValueLookupParameter<DoubleMatrix>).Value != null) { 64 distance = (distanceMatrix as IValueLookupParameter<DoubleMatrix>).Value[start, end]; 65 } else { 66 if (distanceMatrix.ActualValue == null) { 67 distanceMatrix.ActualValue = CreateDistanceMatrix(coordinates); 68 } 65 69 66 distance = distanceMatrix.ActualValue[start, end]; 70 distance = distanceMatrix.ActualValue[start, end]; 71 } 67 72 } else { 68 73 distance = CalculateDistance(start, end, coordinates); -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.3/VehicleRoutingProblem.cs
r4241 r4268 34 34 using HeuristicLab.Problems.VehicleRouting.Encodings.Alba; 35 35 using HeuristicLab.Problems.VehicleRouting.Encodings.General; 36 using HeuristicLab.Problems.VehicleRouting.Encodings.Prins; 36 37 37 38 namespace HeuristicLab.Problems.VehicleRouting { … … 386 387 } 387 388 389 foreach (IPrinsOperator op in Operators.OfType<IPrinsOperator>()) { 390 op.FleetUsageFactor.ActualName = FleetUsageFactor.Name; 391 op.TimeFactor.ActualName = TimeFactor.Name; 392 op.DistanceFactor.ActualName = DistanceFactor.Name; 393 op.OverloadPenalty.ActualName = OverloadPenalty.Name; 394 op.TardinessPenalty.ActualName = TardinessPenalty.Name; 395 } 396 388 397 foreach (IVRPMoveEvaluator op in Operators.OfType<IVRPMoveEvaluator>()) { 389 398 op.FleetUsageFactor.ActualName = FleetUsageFactor.Name;
Note: See TracChangeset
for help on using the changeset viewer.