Changeset 4847 for trunk/sources/HeuristicLab.Problems.VehicleRouting
- Timestamp:
- 11/19/10 11:12:40 (14 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Evaluators/VRPEvaluator.cs ¶
r4722 r4847 116 116 DoubleArray serviceTimeArray, DoubleArray readyTimeArray, DoubleArray demandArray, DoubleValue capacity, 117 117 DoubleValue fleetUsageFactor, DoubleValue timeFactor, DoubleValue distanceFactor, DoubleValue overloadPenalty, DoubleValue tardinessPenalty, 118 DoubleMatrix coordinates, I LookupParameter<DoubleMatrix>distanceMatrix, BoolValue useDistanceMatrix) {118 DoubleMatrix coordinates, IParameter distanceMatrix, BoolValue useDistanceMatrix) { 119 119 TourEvaluation eval = new TourEvaluation(); 120 120 … … 190 190 DoubleArray serviceTimeArray, DoubleArray readyTimeArray, DoubleArray demandArray, DoubleValue capacity, 191 191 DoubleValue fleetUsageFactor, DoubleValue timeFactor, DoubleValue distanceFactor, DoubleValue overloadPenalty, DoubleValue tardinessPenalty, 192 DoubleMatrix coordinates, I LookupParameter<DoubleMatrix>distanceMatrix, BoolValue useDistanceMatrix) {192 DoubleMatrix coordinates, IParameter distanceMatrix, BoolValue useDistanceMatrix) { 193 193 TourEvaluation sumEval = new TourEvaluation(); 194 194 sumEval.Distance = 0; … … 199 199 sumEval.Tardiness = 0; 200 200 201 foreach (Tour tour in solution.GetTours(distanceMatrix )) {201 foreach (Tour tour in solution.GetTours(distanceMatrix as ILookupParameter<DoubleMatrix>)) { 202 202 TourEvaluation eval = EvaluateTour(tour, dueTimeArray, serviceTimeArray, readyTimeArray, demandArray, capacity, 203 203 fleetUsageFactor, timeFactor, distanceFactor, overloadPenalty, tardinessPenalty, -
TabularUnified trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/VRPUtilities.cs ¶
r4722 r4847 57 57 58 58 if (useDistanceMatrix.Value) { 59 if (distanceMatrix is IValue LookupParameter<DoubleMatrix>) {60 if ((distanceMatrix as IValue LookupParameter<DoubleMatrix>).Value == null) {61 (distanceMatrix as IValue LookupParameter<DoubleMatrix>).Value = CreateDistanceMatrix(coordinates);59 if (distanceMatrix is IValueParameter<DoubleMatrix>) { 60 if ((distanceMatrix as IValueParameter<DoubleMatrix>).Value == null) { 61 (distanceMatrix as IValueParameter<DoubleMatrix>).Value = CreateDistanceMatrix(coordinates); 62 62 } 63 63 64 distance = (distanceMatrix as IValue LookupParameter<DoubleMatrix>).Value[start, end];64 distance = (distanceMatrix as IValueParameter<DoubleMatrix>).Value[start, end]; 65 65 } else { 66 66 if (distanceMatrix.ActualValue == null) { -
TabularUnified trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/VehicleRoutingProblem.cs ¶
r4722 r4847 620 620 this.Name = parser.ProblemName; 621 621 622 BestKnownSolution = null; 622 623 Coordinates = new DoubleMatrix(parser.Coordinates); 623 624 Vehicles.Value = parser.Vehicles; … … 636 637 637 638 this.Name = parser.Name; 638 639 639 int problemSize = parser.Demands.Length; 640 640 641 BestKnownSolution = null; 641 642 Coordinates = new DoubleMatrix(parser.Vertices); 642 643 if (parser.Vehicles != -1) … … 661 662 662 663 if (parser.Depot != 1) 663 throw new Exception("Invalid depot specification");664 ErrorHandling.ShowErrorDialog(new Exception("Invalid depot specification")); 664 665 665 666 if (parser.WeightType != TSPLIBParser.TSPLIBEdgeWeightType.EUC_2D) 666 throw new Exception("Invalid weight type");667 ErrorHandling.ShowErrorDialog(new Exception("Invalid weight type")); 667 668 668 669 OnReset(); … … 672 673 if (BestKnownSolution != null) { 673 674 //call evaluator 674 IValue LookupParameter<DoubleMatrix> distMatrix = new ValueLookupParameter<DoubleMatrix>("DistMatrix",675 IValueParameter<DoubleMatrix> distMatrix = new ValueParameter<DoubleMatrix>("DistMatrix", 675 676 DistanceMatrix); 676 677 … … 716 717 717 718 if (cities != Coordinates.Rows - 1) 718 throw new Exception("Invalid solution");719 720 BestKnownSolutionParameter.Value = encoding;719 ErrorHandling.ShowErrorDialog(new Exception("Invalid solution")); 720 else 721 BestKnownSolutionParameter.Value = encoding; 721 722 } 722 723 … … 728 729 int problemSize = parser.Demands.Length; 729 730 731 BestKnownSolution = null; 730 732 Coordinates = new DoubleMatrix(parser.Vertices); 731 733 Vehicles.Value = problemSize - 1;
Note: See TracChangeset
for help on using the changeset viewer.