Changeset 11319
- Timestamp:
- 09/01/14 10:03:12 (10 years ago)
- Location:
- branches/HeuristicLab.Problems.Orienteering
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Instances.Orienteering/3.3/SchildeInstanceProvider.cs
r11299 r11319 96 96 MaximumDistance = parser.UpperBoundConstraint, 97 97 StartingPoint = parser.StartingPoint, 98 Termin usPoint = parser.TerminusPoint,98 TerminalPoint = parser.TerminalPoint, 99 99 Scores = Enumerable.Range(0, parser.Scores.GetLength(0)).Select(i => parser.Scores[i, 0]).ToArray() 100 100 }; -
branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Instances.Orienteering/3.3/SchildeParser.cs
r11299 r11319 37 37 public double[,] Scores { get; private set; } 38 38 public int StartingPoint { get; private set; } 39 public int Termin usPoint { get; private set; }39 public int TerminalPoint { get; private set; } 40 40 public double UpperBoundConstraint { get; private set; } 41 41 public double LowerConstraint { get; private set; } … … 49 49 Scores = null; 50 50 StartingPoint = 0; 51 Termin usPoint = 0;51 TerminalPoint = 0; 52 52 UpperBoundConstraint = 0.0; 53 53 LowerConstraint = 0.0; … … 222 222 // Remove the 'e,' 223 223 inputString = inputString.Remove(0, inputString.IndexOf(',') + 1); 224 Termin usPoint = int.Parse(inputString, FormatProvider);224 TerminalPoint = int.Parse(inputString, FormatProvider); 225 225 break; 226 226 -
branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Instances/3.3/Types/OPData.cs
r11260 r11319 45 45 /// Index of the ending point. 46 46 /// </summary> 47 public int Termin usPoint { get; set; }47 public int TerminalPoint { get; set; } 48 48 } 49 49 } -
branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering.Views/3.3/OrienteeringProblemView.cs
r11311 r11319 41 41 Content.CoordinatesParameter.ValueChanged -= new EventHandler(CoordinatesParameter_ValueChanged); 42 42 Content.StartingPointParameter.ValueChanged -= new EventHandler(StartingPointParameter_ValueChanged); 43 Content.Termin usPointParameter.ValueChanged -= new EventHandler(TerminusPointParameter_ValueChanged);43 Content.TerminalPointParameter.ValueChanged -= new EventHandler(TerminalPointParameter_ValueChanged); 44 44 Content.ScoresParameter.ValueChanged -= new EventHandler(ScoresParameter_ValueChanged); 45 45 Content.BestKnownQualityParameter.ValueChanged -= new EventHandler(BestKnownQualityParameter_ValueChanged); … … 51 51 Content.CoordinatesParameter.ValueChanged += new EventHandler(CoordinatesParameter_ValueChanged); 52 52 Content.StartingPointParameter.ValueChanged += new EventHandler(StartingPointParameter_ValueChanged); 53 Content.Termin usPointParameter.ValueChanged += new EventHandler(TerminusPointParameter_ValueChanged);53 Content.TerminalPointParameter.ValueChanged += new EventHandler(TerminalPointParameter_ValueChanged); 54 54 Content.ScoresParameter.ValueChanged += new EventHandler(ScoresParameter_ValueChanged); 55 55 Content.BestKnownQualityParameter.ValueChanged += new EventHandler(BestKnownQualityParameter_ValueChanged); … … 63 63 } else { 64 64 orienteeringSolutionView.Content = new OrienteeringSolution( 65 Content.BestKnownSolution, Content.Coordinates, Content.StartingPoint, Content.Termin usPoint, Content.Scores, Content.BestKnownQuality, penalty: null);65 Content.BestKnownSolution, Content.Coordinates, Content.StartingPoint, Content.TerminalPoint, Content.Scores, Content.BestKnownQuality, penalty: null); 66 66 } 67 67 } … … 78 78 orienteeringSolutionView.Content.StartingPoint = Content.StartingPoint; 79 79 } 80 private void Termin usPointParameter_ValueChanged(object sender, EventArgs e) {81 orienteeringSolutionView.Content.Termin usPoint = Content.TerminusPoint;80 private void TerminalPointParameter_ValueChanged(object sender, EventArgs e) { 81 orienteeringSolutionView.Content.TerminalPoint = Content.TerminalPoint; 82 82 } 83 83 private void ScoresParameter_ValueChanged(object sender, EventArgs e) { -
branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering.Views/3.3/OrienteeringSolutionView.cs
r11314 r11319 45 45 Content.CoordinatesChanged -= new EventHandler(Content_CoordinatesChanged); 46 46 Content.StartingPointChanged -= new EventHandler(Content_StartingPointChanged); 47 Content.Termin usPointChanged -= new EventHandler(Content_TerminusPointChanged);47 Content.TerminalPointChanged -= new EventHandler(Content_TerminalPointChanged); 48 48 Content.ScoresChanged -= new EventHandler(Content_ScoresChanged); 49 49 Content.IntegerVectorChanged -= new EventHandler(Content_IntegerVectorChanged); … … 56 56 Content.CoordinatesChanged += new EventHandler(Content_CoordinatesChanged); 57 57 Content.StartingPointChanged += new EventHandler(Content_StartingPointChanged); 58 Content.Termin usPointChanged += new EventHandler(Content_TerminusPointChanged);58 Content.TerminalPointChanged += new EventHandler(Content_TerminalPointChanged); 59 59 Content.ScoresChanged += new EventHandler(Content_ScoresChanged); 60 60 Content.IntegerVectorChanged += new EventHandler(Content_IntegerVectorChanged); … … 131 131 } 132 132 int startingPoint = Content.StartingPoint.Value; 133 int termin usPoint = Content.TerminusPoint.Value;133 int terminalPoint = Content.TerminalPoint.Value; 134 134 Font font = new Font(FontFamily.GenericSansSerif, 10, FontStyle.Regular); 135 135 var beginSize = graphics.MeasureString("Begin", font); 136 136 graphics.DrawString("Begin", font, Brushes.Black, points[startingPoint].X - beginSize.Width, points[startingPoint].Y - beginSize.Height); 137 graphics.DrawString("End", font, Brushes.Black, points[termin usPoint].X, points[terminusPoint].Y);137 graphics.DrawString("End", font, Brushes.Black, points[terminalPoint].X, points[terminalPoint].Y); 138 138 } 139 139 } else { … … 175 175 GenerateImage(); 176 176 } 177 private void Content_Termin usPointChanged(object sender, EventArgs e) {178 if (InvokeRequired) 179 Invoke(new EventHandler(Content_Termin usPointChanged), sender, e);177 private void Content_TerminalPointChanged(object sender, EventArgs e) { 178 if (InvokeRequired) 179 Invoke(new EventHandler(Content_TerminalPointChanged), sender, e); 180 180 else 181 181 GenerateImage(); -
branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering/3.3/Analyzers/BestOrienteeringSolutionAnalyser.cs
r11311 r11319 45 45 get { return (ILookupParameter<IntValue>)Parameters["StartingPoint"]; } 46 46 } 47 public ILookupParameter<IntValue> Termin usPointParameter {48 get { return (ILookupParameter<IntValue>)Parameters["Termin usPoint"]; }47 public ILookupParameter<IntValue> TerminalPointParameter { 48 get { return (ILookupParameter<IntValue>)Parameters["TerminalPoint"]; } 49 49 } 50 50 public ILookupParameter<DoubleArray> ScoresParameter { … … 85 85 Parameters.Add(new LookupParameter<DoubleMatrix>("Coordinates", "The x- and y-Coordinates of the points.")); 86 86 Parameters.Add(new LookupParameter<IntValue>("StartingPoint", "Index of the starting point.")); 87 Parameters.Add(new LookupParameter<IntValue>("Termin usPoint", "Index of the ending point."));87 Parameters.Add(new LookupParameter<IntValue>("TerminalPoint", "Index of the ending point.")); 88 88 Parameters.Add(new LookupParameter<DoubleArray>("Scores", "The scores of the points.")); 89 89 Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The qualities of the Orienteering solutions which should be analyzed.")); … … 114 114 var coordinates = CoordinatesParameter.ActualValue; 115 115 var startingPoint = StartingPointParameter.ActualValue; 116 var termin usPoint = TerminusPointParameter.ActualValue;116 var terminalPoint = TerminalPointParameter.ActualValue; 117 117 var scores = ScoresParameter.ActualValue; 118 118 if (solution == null) { … … 121 121 coordinates, 122 122 startingPoint, 123 termin usPoint,123 terminalPoint, 124 124 scores, 125 125 new DoubleValue(qualities[bestIndex].Value), -
branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering/3.3/Creators/GreedyOrienteeringTourCreator.cs
r11307 r11319 52 52 get { return (ILookupParameter<IntValue>)Parameters["StartingPoint"]; } 53 53 } 54 public ILookupParameter<IntValue> Termin usPointParameter {55 get { return (ILookupParameter<IntValue>)Parameters["Termin usPoint"]; }54 public ILookupParameter<IntValue> TerminalPointParameter { 55 get { return (ILookupParameter<IntValue>)Parameters["TerminalPoint"]; } 56 56 } 57 57 public ILookupParameter<DoubleValue> FixedPenaltyParameter { … … 72 72 Parameters.Add(new LookupParameter<DoubleValue>("MaximumDistance", "The maximum distance constraint for a Orienteering solution.")); 73 73 Parameters.Add(new LookupParameter<IntValue>("StartingPoint", "Index of the starting point.")); 74 Parameters.Add(new LookupParameter<IntValue>("Termin usPoint", "Index of the ending point."));74 Parameters.Add(new LookupParameter<IntValue>("TerminalPoint", "Index of the ending point.")); 75 75 Parameters.Add(new LookupParameter<DoubleValue>("FixedPenalty", "The penalty for each visited vertex.")); 76 76 } … … 82 82 protected override IntegerVector Create(IRandom _, IntValue __, IntMatrix ___) { 83 83 int startPoint = StartingPointParameter.ActualValue.Value; 84 int endPoint = Termin usPointParameter.ActualValue.Value;84 int endPoint = TerminalPointParameter.ActualValue.Value; 85 85 int numPoints = ScoresParameter.ActualValue.Length; 86 86 var distances = DistanceMatrixParameter.ActualValue; -
branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering/3.3/Improvers/OrienteeringLocalImprovementOperator.cs
r11307 r11319 55 55 get { return (ILookupParameter<IntValue>)Parameters["StartingPoint"]; } 56 56 } 57 public ILookupParameter<IntValue> Termin usPointParameter {58 get { return (ILookupParameter<IntValue>)Parameters["Termin usPoint"]; }57 public ILookupParameter<IntValue> TerminalPointParameter { 58 get { return (ILookupParameter<IntValue>)Parameters["TerminalPoint"]; } 59 59 } 60 60 public ILookupParameter<DoubleValue> FixedPenaltyParameter { … … 98 98 Parameters.Add(new LookupParameter<DoubleValue>("MaximumDistance", "The maximum distance constraint for a Orienteering solution.")); 99 99 Parameters.Add(new LookupParameter<IntValue>("StartingPoint", "Index of the starting point.")); 100 Parameters.Add(new LookupParameter<IntValue>("Termin usPoint", "Index of the ending point."));100 Parameters.Add(new LookupParameter<IntValue>("TerminalPoint", "Index of the ending point.")); 101 101 Parameters.Add(new LookupParameter<DoubleValue>("FixedPenalty", "The penalty for each visited vertex.")); 102 102 -
branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering/3.3/OrienteeringProblem.cs
r11316 r11319 55 55 get { return (ValueParameter<IntValue>)Parameters["StartingPoint"]; } 56 56 } 57 public ValueParameter<IntValue> Termin usPointParameter {58 get { return (ValueParameter<IntValue>)Parameters["Termin usPoint"]; }57 public ValueParameter<IntValue> TerminalPointParameter { 58 get { return (ValueParameter<IntValue>)Parameters["TerminalPoint"]; } 59 59 } 60 60 public ValueParameter<DoubleValue> MaximumDistanceParameter { … … 86 86 set { StartingPointParameter.Value = value; } 87 87 } 88 public IntValue Termin usPoint {89 get { return Termin usPointParameter.Value; }90 set { Termin usPointParameter.Value = value; }88 public IntValue TerminalPoint { 89 get { return TerminalPointParameter.Value; } 90 set { TerminalPointParameter.Value = value; } 91 91 } 92 92 public DoubleValue MaximumDistance { … … 127 127 Parameters.Add(new ValueParameter<DistanceMatrix>("DistanceMatrix", "The matrix which contains the distances between the points.")); 128 128 Parameters.Add(new ValueParameter<IntValue>("StartingPoint", "Index of the starting point.", new IntValue(0))); 129 Parameters.Add(new ValueParameter<IntValue>("Termin usPoint", "Index of the ending point.", new IntValue(0)));129 Parameters.Add(new ValueParameter<IntValue>("TerminalPoint", "Index of the ending point.", new IntValue(0))); 130 130 Parameters.Add(new ValueParameter<DoubleValue>("MaximumDistance", "The maximum distance constraint for a Orienteering solution.")); 131 131 Parameters.Add(new ValueParameter<DoubleArray>("Scores", "The scores of the points.")); … … 186 186 } 187 187 188 private void Termin usPointParameter_ValueChanged(object sender, EventArgs e) {188 private void TerminalPointParameter_ValueChanged(object sender, EventArgs e) { 189 189 ParameterizeEvaluator(); 190 190 ParameterizeAnalyzer(); … … 226 226 227 227 StartingPointParameter.ValueChanged += StartingPointParameter_ValueChanged; 228 Termin usPointParameter.ValueChanged += TerminusPointParameter_ValueChanged;228 TerminalPointParameter.ValueChanged += TerminalPointParameter_ValueChanged; 229 229 MaximumDistanceParameter.ValueChanged += MaximumDistanceParameter_ValueChanged; 230 230 … … 241 241 creator.MaximumDistanceParameter.ActualName = MaximumDistanceParameter.Name; 242 242 creator.StartingPointParameter.ActualName = StartingPointParameter.Name; 243 creator.Termin usPointParameter.ActualName = TerminusPointParameter.Name;243 creator.TerminalPointParameter.ActualName = TerminalPointParameter.Name; 244 244 creator.FixedPenaltyParameter.ActualName = FixedPenaltyParameter.Name; 245 245 } … … 280 280 op.MaximumDistanceParameter.ActualName = MaximumDistanceParameter.Name; 281 281 op.StartingPointParameter.ActualName = StartingPointParameter.Name; 282 op.Termin usPointParameter.ActualName = TerminusPointParameter.Name;282 op.TerminalPointParameter.ActualName = TerminalPointParameter.Name; 283 283 op.FixedPenaltyParameter.ActualName = FixedPenaltyParameter.Name; 284 284 } … … 289 289 op.MaximumDistanceParameter.ActualName = MaximumDistanceParameter.Name; 290 290 op.StartingPointParameter.ActualName = StartingPointParameter.Name; 291 op.Termin usPointParameter.ActualName = TerminusPointParameter.Name;291 op.TerminalPointParameter.ActualName = TerminalPointParameter.Name; 292 292 op.FixedPenaltyParameter.ActualName = FixedPenaltyParameter.Name; 293 293 } … … 334 334 335 335 StartingPoint.Value = 0; 336 Termin usPoint.Value = 20;336 TerminalPoint.Value = 20; 337 337 MaximumDistance.Value = 30; 338 338 … … 360 360 361 361 StartingPoint = new IntValue(data.StartingPoint); 362 Termin usPoint = new IntValue(data.TerminusPoint);362 TerminalPoint = new IntValue(data.TerminalPoint); 363 363 364 364 MaximumDistance = new DoubleValue(data.MaximumDistance); … … 386 386 387 387 StartingPoint = new IntValue(0); // First city is interpreted as start point 388 Termin usPoint = new IntValue(data.Dimension - 1); // Last city is interpreted als end point388 TerminalPoint = new IntValue(data.Dimension - 1); // Last city is interpreted als end point 389 389 390 390 MaximumDistance = new DoubleValue(DistanceMatrix.Average() * 5.0); // distance from start to end first to last city is interpreted as maximum distance … … 411 411 412 412 StartingPoint = new IntValue(0); // Depot is interpreted as start point 413 Termin usPoint = new IntValue(0); // Depot is interpreted als end point413 TerminalPoint = new IntValue(0); // Depot is interpreted als end point 414 414 415 415 MaximumDistance = new DoubleValue(data.Capacity * 2); // capacity is interpreted as max distance -
branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering/3.3/OrienteeringSolution.cs
r11311 r11319 55 55 } 56 56 [Storable] 57 private IntValue termin usPoint;58 public IntValue Termin usPoint {59 get { return termin usPoint; }60 set { 61 if (termin usPoint != value) {62 if (termin usPoint != null) DeregisterTerminusPointEvents();63 termin usPoint = value;64 if (termin usPoint != null) RegisterTerminusPointEvents();65 OnTermin usPointChanged();57 private IntValue terminalPoint; 58 public IntValue TerminalPoint { 59 get { return terminalPoint; } 60 set { 61 if (terminalPoint != value) { 62 if (terminalPoint != null) DeregisterTerminalPointEvents(); 63 terminalPoint = value; 64 if (terminalPoint != null) RegisterTerminalPointEvents(); 65 OnTerminalPointChanged(); 66 66 } 67 67 } … … 118 118 Initialize(); 119 119 } 120 public OrienteeringSolution(IntegerVector integerVector, DoubleMatrix coordinates, IntValue startingPoint, IntValue termin usPoint,120 public OrienteeringSolution(IntegerVector integerVector, DoubleMatrix coordinates, IntValue startingPoint, IntValue terminalPoint, 121 121 DoubleArray scores, DoubleValue quality, DoubleValue penalty) 122 122 : base() { … … 124 124 this.coordinates = coordinates; 125 125 this.startingPoint = startingPoint; 126 this.termin usPoint = terminusPoint;126 this.terminalPoint = terminalPoint; 127 127 this.scores = scores; 128 128 this.quality = quality; … … 144 144 if (coordinates != null) RegisterCoordinatesEvents(); 145 145 if (startingPoint != null) RegisterStartingPointEvents(); 146 if (termin usPoint != null) RegisterTerminusPointEvents();146 if (terminalPoint != null) RegisterTerminalPointEvents(); 147 147 if (scores != null) RegisterScoresEvents(); 148 148 if (quality != null) RegisterQualityEvents(); … … 172 172 } 173 173 174 public event EventHandler Termin usPointChanged;175 private void OnTermin usPointChanged() {176 var changed = Termin usPointChanged;174 public event EventHandler TerminalPointChanged; 175 private void OnTerminalPointChanged() { 176 var changed = TerminalPointChanged; 177 177 if (changed != null) 178 178 changed(this, EventArgs.Empty); … … 222 222 StartingPoint.ValueChanged -= new EventHandler(StartingPoint_ValueChanged); 223 223 } 224 private void RegisterTermin usPointEvents() {225 Termin usPoint.ValueChanged += new EventHandler(TerminusPoint_ValueChanged);226 } 227 private void DeregisterTermin usPointEvents() {228 Termin usPoint.ValueChanged -= new EventHandler(TerminusPoint_ValueChanged);224 private void RegisterTerminalPointEvents() { 225 TerminalPoint.ValueChanged += new EventHandler(TerminalPoint_ValueChanged); 226 } 227 private void DeregisterTerminalPointEvents() { 228 TerminalPoint.ValueChanged -= new EventHandler(TerminalPoint_ValueChanged); 229 229 } 230 230 private void RegisterScoresEvents() { … … 264 264 OnStartingPointChanged(); 265 265 } 266 private void Termin usPoint_ValueChanged(object sender, EventArgs e) {267 OnTermin usPointChanged();266 private void TerminalPoint_ValueChanged(object sender, EventArgs e) { 267 OnTerminalPointChanged(); 268 268 } 269 269 private void Scores_ItemChanged(object sender, EventArgs<int> e) { -
branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering/3.3/Shakers/OrienteeringShakingOperator.cs
r11307 r11319 67 67 get { return (ILookupParameter<IntValue>)Parameters["StartingPoint"]; } 68 68 } 69 public ILookupParameter<IntValue> Termin usPointParameter {70 get { return (ILookupParameter<IntValue>)Parameters["Termin usPoint"]; }69 public ILookupParameter<IntValue> TerminalPointParameter { 70 get { return (ILookupParameter<IntValue>)Parameters["TerminalPoint"]; } 71 71 } 72 72 public ILookupParameter<DistanceMatrix> DistanceMatrixParameter { … … 98 98 Parameters.Add(new LookupParameter<DoubleValue>("MaximumDistance", "The maximum distance constraint for a Orienteering solution.")); 99 99 Parameters.Add(new LookupParameter<IntValue>("StartingPoint", "Index of the starting point.")); 100 Parameters.Add(new LookupParameter<IntValue>("Termin usPoint", "Index of the ending point."));100 Parameters.Add(new LookupParameter<IntValue>("TerminalPoint", "Index of the ending point.")); 101 101 Parameters.Add(new LookupParameter<DistanceMatrix>("DistanceMatrix", "The matrix which contains the distances between the points.")); 102 102 Parameters.Add(new LookupParameter<DoubleArray>("Scores", "The scores of the points.")); … … 115 115 var scores = ScoresParameter.ActualValue; 116 116 var startingPoint = StartingPointParameter.ActualValue.Value; 117 var termin usPoint = TerminusPointParameter.ActualValue.Value;117 var terminalPoint = TerminalPointParameter.ActualValue.Value; 118 118 var fixedPenalty = FixedPenaltyParameter.ActualValue.Value; 119 119 double maxDistance = MaximumDistanceParameter.ActualValue.Value; … … 139 139 from point in Enumerable.Range(0, numPoints) 140 140 // Calculate the distance when going from the starting point to this point and then to the end point 141 let distance = distances[startingPoint, point] + distances[point, termin usPoint] + fixedPenalty141 let distance = distances[startingPoint, point] + distances[point, terminalPoint] + fixedPenalty 142 142 // If this distance is feasible and the point is neither starting nor ending point, check the point 143 where distance < maxDistance && point != startingPoint && point != termin usPoint143 where distance < maxDistance && point != startingPoint && point != terminalPoint 144 144 // The point was not yet visited, so add it to the candidate list 145 145 where !initialTour.Contains(point)
Note: See TracChangeset
for help on using the changeset viewer.