- Timestamp:
- 07/16/14 14:39:28 (10 years ago)
- Location:
- branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering/3.3
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering/3.3/Creators/GreedyOrienteeringTourCreator.cs
r11192 r11194 113 113 for (int insertPosition = 1; insertPosition < tour.Count; insertPosition++) { 114 114 // Create the candidate tour 115 double detour = distances.CalculateInsertionCost (tour, orderedFeasiblePoints[candidatePoint].Index, insertPosition, fixedPenalty);115 double detour = distances.CalculateInsertionCosts(tour, orderedFeasiblePoints[candidatePoint].Index, insertPosition, fixedPenalty); 116 116 117 117 // If the insertion would be feasible, perform it -
branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering/3.3/Evaluators/OrienteeringEvaluator.cs
r11191 r11194 33 33 get { return (ILookupParameter<DoubleValue>)Parameters["Quality"]; } 34 34 } 35 public ILookupParameter<IntegerVector> SolutionParameter {35 public ILookupParameter<IntegerVector> IntegerVectorParameter { 36 36 get { return (ILookupParameter<IntegerVector>)Parameters["IntegerVector"]; } 37 37 } … … 75 75 76 76 public override IOperation InstrumentedApply() { 77 var evaluation = Apply( SolutionParameter.ActualValue, ScoresParameter.ActualValue);77 var evaluation = Apply(IntegerVectorParameter.ActualValue, ScoresParameter.ActualValue); 78 78 79 79 QualityParameter.ActualValue = evaluation.Quality; -
branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering/3.3/Improvers/OrienteeringLocalImprovementOperator.cs
r11193 r11194 37 37 minimize the cost of the tour. As shortening operator a 2-opt is applied. (Schilde et. al. 2009)")] 38 38 [StorableClass] 39 public class OrienteeringLocalImprovementOperator : SingleSuccessorOperator, ILocalImprovementOperator , IStochasticOperator{39 public class OrienteeringLocalImprovementOperator : SingleSuccessorOperator, ILocalImprovementOperator { 40 40 #region IGenericLocalImprovementOperator Properties 41 41 public Type ProblemType { get { return typeof(OrienteeringProblem); } } … … 81 81 get { return (ILookupParameter<DoubleValue>)Parameters["FixedPenalty"]; } 82 82 } 83 public ILookupParameter<IRandom> RandomParameter {84 get { return (ILookupParameter<IRandom>)Parameters["Random"]; }85 }86 83 #region ILocalImprovementOperator Parameters 87 84 public IValueLookupParameter<IntValue> MaximumIterationsParameter { … … 106 103 public OrienteeringLocalImprovementOperator() 107 104 : base() { 105 Parameters.Add(new LookupParameter<IntegerVector>("IntegerVector", "The Orienteering Solution given in path representation.")); 108 106 Parameters.Add(new LookupParameter<DistanceMatrix>("DistanceMatrix", "The matrix which contains the distances between the points.")); 109 107 Parameters.Add(new LookupParameter<DoubleArray>("Scores", "The scores of the points.")); … … 112 110 Parameters.Add(new LookupParameter<IntValue>("TerminusPoint", "Index of the ending point.")); 113 111 Parameters.Add(new LookupParameter<DoubleValue>("FixedPenalty", "The penalty for each visited vertex.")); 114 Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator to use."));115 112 Parameters.Add(new ValueLookupParameter<IntValue>("MaximumIterations", "The maximum number of generations which should be processed.", new IntValue(150))); 116 113 Parameters.Add(new LookupParameter<IntValue>("EvaluatedSolutions", "The number of evaluated moves.")); … … 130 127 131 128 public override IOperation Apply() { 129 // TODO Use LocalImprovementorOperator Parameters 130 132 131 int numPoints = ScoresParameter.ActualValue.Length; 133 132 var distances = DistanceMatrixParameter.ActualValue; … … 136 135 137 136 bool optimizationDone = true; 138 bool isFeasible = true;139 137 140 138 // Find the maximum distance restriction … … 227 225 if (optimizationDone) break; 228 226 229 double detour = distances.CalculateInsertionCost (tour, tourPosition, visitablePoints[i], fixedPenalty);227 double detour = distances.CalculateInsertionCosts(tour, tourPosition, visitablePoints[i], fixedPenalty); 230 228 231 229 // Determine if including the point does not violate any constraint … … 255 253 if (optimizationDone) break; 256 254 257 double detour = distances.CalculateReplacementCost (tour, tourPosition, visitablePoints[i]);255 double detour = distances.CalculateReplacementCosts(tour, tourPosition, visitablePoints[i]); 258 256 259 257 double oldPointScore = scores[tour[tourPosition]]; -
branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering/3.3/OrienteeringProblem.cs
r11191 r11194 29 29 using HeuristicLab.Parameters; 30 30 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 31 using HeuristicLab.PluginInfrastructure;32 31 using HeuristicLab.Problems.Instances; 33 32 … … 246 245 private void ParameterizeEvaluator() { 247 246 if (Evaluator is OrienteeringEvaluator) { 248 var orienteeringEvaluator = (OrienteeringEvaluator)Evaluator;249 orienteeringEvaluator.SolutionParameter.ActualName = SolutionCreator.IntegerVectorParameter.ActualName;250 orienteeringEvaluator.ScoresParameter.ActualName = ScoresParameter.Name;247 var evaluator = (OrienteeringEvaluator)Evaluator; 248 evaluator.IntegerVectorParameter.ActualName = SolutionCreator.IntegerVectorParameter.ActualName; 249 evaluator.ScoresParameter.ActualName = ScoresParameter.Name; 251 250 } 252 251 } … … 268 267 ParameterizeAnalyzer(); 269 268 270 var operators = ApplicationManager.Manager.GetInstances<IIntegerVectorOperator>(); 271 Operators.AddRange(operators); 269 Operators.Add(new OrienteeringLocalImprovementOperator()); 270 //var operators = ApplicationManager.Manager.GetInstances<IIntegerVectorOperator>(); 271 //Operators.AddRange(operators); 272 272 ParameterizeOperators(); 273 273 } 274 274 private void ParameterizeOperators() { 275 //foreach (var op in Operators.OfType<IIntegerVectorManipulator>()) 276 // op.IntegerVectorParameter.ActualName = SolutionCreator.IntegerVectorParameter.ActualName; 277 foreach (var op in Operators.OfType<IIntegerVectorMultiNeighborhoodShakingOperator>()) 275 foreach (var op in Operators.OfType<OrienteeringLocalImprovementOperator>()) { 278 276 op.IntegerVectorParameter.ActualName = SolutionCreator.IntegerVectorParameter.ActualName; 279 foreach (var op in Operators.OfType<ISingleObjectiveImprovementOperator>()) 280 op.SolutionParameter.ActualName = SolutionCreator.IntegerVectorParameter.ActualName; 277 op.DistanceMatrixParameter.ActualName = DistanceMatrixParameter.Name; 278 op.ScoresParameter.ActualName = ScoresParameter.Name; 279 op.MaximumDistanceParameter.ActualName = MaximumDistanceParameter.Name; 280 op.StartingPointParameter.ActualName = StartingPointParameter.Name; 281 op.TerminusPointParameter.ActualName = TerminusPointParameter.Name; 282 op.FixedPenaltyParameter.ActualName = FixedPenaltyParameter.Name; 283 284 } 281 285 } 282 286 #endregion
Note: See TracChangeset
for help on using the changeset viewer.