- Timestamp:
- 09/10/10 13:58:35 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/VRPProblemInstance.cs
r4378 r4380 56 56 get { return (ValueParameter<DoubleMatrix>)Parameters["Coordinates"]; } 57 57 } 58 protected OptionalValueParameter<DoubleMatrix> DistanceMatrixParameter { 59 get { return (OptionalValueParameter<DoubleMatrix>)Parameters["DistanceMatrix"]; } 60 } 58 61 protected ValueParameter<BoolValue> UseDistanceMatrixParameter { 59 62 get { return (ValueParameter<BoolValue>)Parameters["UseDistanceMatrix"]; } … … 77 80 set { CoordinatesParameter.Value = value; } 78 81 } 79 80 [Storable] 81 public DoubleMatrix DistanceMatrix { get; set; } 82 82 83 public DoubleMatrix DistanceMatrix { 84 get { return DistanceMatrixParameter.Value; } 85 set { DistanceMatrixParameter.Value = value; } 86 } 83 87 public BoolValue UseDistanceMatrix { 84 88 get { return UseDistanceMatrixParameter.Value; } … … 134 138 public double GetDistance(int start, int end) { 135 139 double distance = 0.0; 140 DoubleMatrix distanceMatrix = DistanceMatrix; 136 141 137 if (DistanceMatrix == null && UseDistanceMatrix.Value) 138 DistanceMatrix = CreateDistanceMatrix(); 139 140 if(DistanceMatrix != null) 141 distance = DistanceMatrix[start, end]; 142 if (distanceMatrix == null && UseDistanceMatrix.Value) { 143 distanceMatrix = DistanceMatrix = CreateDistanceMatrix(); 144 } 145 146 if (distanceMatrix != null) 147 distance = distanceMatrix[start, end]; 142 148 else 143 149 distance = CalculateDistance(start, end); … … 175 181 : base() { 176 182 Parameters.Add(new ValueParameter<DoubleMatrix>("Coordinates", "The x- and y-Coordinates of the cities.", new DoubleMatrix())); 183 Parameters.Add(new OptionalValueParameter<DoubleMatrix>("DistanceMatrix", "The matrix which contains the distances between the cities.")); 177 184 Parameters.Add(new ValueParameter<BoolValue>("UseDistanceMatrix", "True if a distance matrix should be calculated and used for evaluation, otherwise false.", new BoolValue(true))); 178 185 Parameters.Add(new ValueParameter<IntValue>("Vehicles", "The number of vehicles.", new IntValue(0)));
Note: See TracChangeset
for help on using the changeset viewer.