Changeset 12721 for branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering/3.3/Creators/GreedyOrienteeringTourCreator.cs
- Timestamp:
- 07/10/15 16:38:17 (9 years ago)
- Location:
- branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering/3.3
- Property svn:ignore
-
old new 2 2 obj 3 3 Plugin.cs 4 *.DotSettings
-
- Property svn:ignore
-
branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering/3.3/Creators/GreedyOrienteeringTourCreator.cs
r11321 r12721 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 30 30 31 31 namespace HeuristicLab.Problems.Orienteering { 32 [Item("GreedyOrienteeringTourCreator", @"The initial solution for P-VNS is generated by means of a greedy algorithm that takes into 33 account all vertices vi that are located within the cost limit Tmax. These points are sorted 34 in descending order regarding the sum of their objective values. Afterwards, the algorithm 35 starts with a tour only including the starting and ending point and successively inserts the 36 points from this list at the first position in which they can feasibly be inserted. (Schilde et. al. 2009)")] 32 /// <summary> 33 /// The initial solution for P-VNS is generated by means of a greedy algorithm that takes into 34 /// account all vertices vi that are located within the cost limit Tmax. These points are sorted 35 /// in descending order regarding the sum of their objective values. Afterwards, the algorithm 36 /// starts with a tour only including the starting and ending point and successively inserts the 37 /// points from this list at the first position in which they can feasibly be inserted. 38 /// (Schilde et. al. 2009) 39 /// </summary> 40 [Item("GreedyOrienteeringTourCreator", @"Implements the solution creation procedure described in Schilde M., Doerner K.F., Hartl R.F., Kiechle G. 2009. Metaheuristics for the bi-objective orienteering problem. Swarm Intelligence, Volume 3, Issue 3, pp 179-201.")] 37 41 [StorableClass] 38 42 public sealed class GreedyOrienteeringTourCreator : IntegerVectorCreator, IOrienteeringSolutionCreator { … … 80 84 } 81 85 82 protected override IntegerVector Create(IRandom _, IntValue __, IntMatrix ___) {86 protected override IntegerVector Create(IRandom random, IntValue length, IntMatrix bounds) { 83 87 int startPoint = StartingPointParameter.ActualValue.Value; 84 88 int endPoint = TerminalPointParameter.ActualValue.Value; … … 105 109 endPoint 106 110 }; 107 double length = distances[startPoint, endPoint];111 double tourLength = distances[startPoint, endPoint]; 108 112 109 113 // Add points in a greedy way … … 118 122 119 123 // If the insertion would be feasible, perform it 120 if ( length + detour <= maxDistance) {124 if (tourLength + detour <= maxDistance) { 121 125 tour.Insert(insertPosition, feasiblePoints[i]); 122 length += detour;126 tourLength += detour; 123 127 feasiblePoints.RemoveAt(i); 124 128 insertionPerformed = true;
Note: See TracChangeset
for help on using the changeset viewer.