Changeset 3066 for trunk/sources/HeuristicLab.Problems.TSP/3.3/TSP.cs
- Timestamp:
- 03/16/10 16:04:54 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.TSP/3.3/TSP.cs
r3053 r3066 52 52 get { return (ValueParameter<DoubleMatrix>)Parameters["Coordinates"]; } 53 53 } 54 public OptionalValueParameter<DoubleMatrix> DistanceMatrixParameter { 55 get { return (OptionalValueParameter<DoubleMatrix>)Parameters["DistanceMatrix"]; } 56 } 57 public ValueParameter<BoolValue> UseDistanceMatrixParameter { 58 get { return (ValueParameter<BoolValue>)Parameters["UseDistanceMatrix"]; } 59 } 54 60 public ValueParameter<IPermutationCreator> SolutionCreatorParameter { 55 61 get { return (ValueParameter<IPermutationCreator>)Parameters["SolutionCreator"]; } … … 74 80 set { CoordinatesParameter.Value = value; } 75 81 } 82 public DoubleMatrix DistanceMatrix { 83 get { return DistanceMatrixParameter.Value; } 84 set { DistanceMatrixParameter.Value = value; } 85 } 86 public BoolValue UseDistanceMatrix { 87 get { return UseDistanceMatrixParameter.Value; } 88 set { UseDistanceMatrixParameter.Value = value; } 89 } 76 90 public IPermutationCreator SolutionCreator { 77 91 get { return SolutionCreatorParameter.Value; } … … 108 122 Parameters.Add(new ValueParameter<BoolValue>("Maximization", "Set to false as the Traveling Salesman Problem is a minimization problem.", new BoolValue(false))); 109 123 Parameters.Add(new ValueParameter<DoubleMatrix>("Coordinates", "The x- and y-Coordinates of the cities.", new DoubleMatrix(0, 0))); 124 Parameters.Add(new OptionalValueParameter<DoubleMatrix>("DistanceMatrix", "The matrix which contains the distances between the cities.")); 125 Parameters.Add(new ValueParameter<BoolValue>("UseDistanceMatrix", "True if a distance matrix should be calculated and used for evaluation, otherwise false.", new BoolValue(true))); 110 126 Parameters.Add(new ValueParameter<IPermutationCreator>("SolutionCreator", "The operator which should be used to create new TSP solutions.", creator)); 111 127 Parameters.Add(new ValueParameter<ITSPEvaluator>("Evaluator", "The operator which should be used to evaluate TSP solutions.", evaluator)); … … 155 171 Coordinates.Reset += new EventHandler(Coordinates_Reset); 156 172 ParameterizeSolutionCreator(); 173 ClearDistanceMatrix(); 157 174 } 158 175 private void Coordinates_ItemChanged(object sender, EventArgs<int, int> e) { 176 ClearDistanceMatrix(); 159 177 } 160 178 private void Coordinates_Reset(object sender, EventArgs e) { 161 179 ParameterizeSolutionCreator(); 180 ClearDistanceMatrix(); 162 181 } 163 182 private void SolutionCreatorParameter_ValueChanged(object sender, EventArgs e) { … … 174 193 private void EvaluatorParameter_ValueChanged(object sender, EventArgs e) { 175 194 ParameterizeEvaluator(); 195 ClearDistanceMatrix(); 176 196 OnEvaluatorChanged(); 177 197 } … … 195 215 if (Evaluator is ITSPPathEvaluator) 196 216 ((ITSPPathEvaluator)Evaluator).PermutationParameter.ActualName = SolutionCreator.PermutationParameter.ActualName; 197 if (Evaluator is ITSPCoordinatesPathEvaluator) 198 ((ITSPCoordinatesPathEvaluator)Evaluator).CoordinatesParameter.ActualName = CoordinatesParameter.Name; 217 if (Evaluator is ITSPCoordinatesPathEvaluator) { 218 ITSPCoordinatesPathEvaluator evaluator = (ITSPCoordinatesPathEvaluator)Evaluator; 219 evaluator.CoordinatesParameter.ActualName = CoordinatesParameter.Name; 220 evaluator.DistanceMatrixParameter.ActualName = DistanceMatrixParameter.Name; 221 evaluator.UseDistanceMatrixParameter.ActualName = UseDistanceMatrixParameter.Name; 222 } 199 223 } 200 224 private void InitializeOperators() { … … 214 238 } 215 239 } 240 private void ClearDistanceMatrix() { 241 DistanceMatrixParameter.Value = null; 242 } 216 243 #endregion 217 244 }
Note: See TracChangeset
for help on using the changeset viewer.