Free cookie consent management tool by TermsFeed Policy Generator

Changeset 11194


Ignore:
Timestamp:
07/16/14 14:39:28 (10 years ago)
Author:
pfleck
Message:

#2208

  • Added OrienteeringLocalImprovementOperator parameterization
  • Renamed some stuff
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  
    113113          for (int insertPosition = 1; insertPosition < tour.Count; insertPosition++) {
    114114            // 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);
    116116
    117117            // If the insertion would be feasible, perform it
  • branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering/3.3/Evaluators/OrienteeringEvaluator.cs

    r11191 r11194  
    3333      get { return (ILookupParameter<DoubleValue>)Parameters["Quality"]; }
    3434    }
    35     public ILookupParameter<IntegerVector> SolutionParameter {
     35    public ILookupParameter<IntegerVector> IntegerVectorParameter {
    3636      get { return (ILookupParameter<IntegerVector>)Parameters["IntegerVector"]; }
    3737    }
     
    7575
    7676    public override IOperation InstrumentedApply() {
    77       var evaluation = Apply(SolutionParameter.ActualValue, ScoresParameter.ActualValue);
     77      var evaluation = Apply(IntegerVectorParameter.ActualValue, ScoresParameter.ActualValue);
    7878
    7979      QualityParameter.ActualValue = evaluation.Quality;
  • branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering/3.3/Improvers/OrienteeringLocalImprovementOperator.cs

    r11193 r11194  
    3737minimize the cost of the tour. As shortening operator a 2-opt is applied. (Schilde et. al. 2009)")]
    3838  [StorableClass]
    39   public class OrienteeringLocalImprovementOperator : SingleSuccessorOperator, ILocalImprovementOperator, IStochasticOperator {
     39  public class OrienteeringLocalImprovementOperator : SingleSuccessorOperator, ILocalImprovementOperator {
    4040    #region IGenericLocalImprovementOperator Properties
    4141    public Type ProblemType { get { return typeof(OrienteeringProblem); } }
     
    8181      get { return (ILookupParameter<DoubleValue>)Parameters["FixedPenalty"]; }
    8282    }
    83     public ILookupParameter<IRandom> RandomParameter {
    84       get { return (ILookupParameter<IRandom>)Parameters["Random"]; }
    85     }
    8683    #region ILocalImprovementOperator Parameters
    8784    public IValueLookupParameter<IntValue> MaximumIterationsParameter {
     
    106103    public OrienteeringLocalImprovementOperator()
    107104      : base() {
     105      Parameters.Add(new LookupParameter<IntegerVector>("IntegerVector", "The Orienteering Solution given in path representation."));
    108106      Parameters.Add(new LookupParameter<DistanceMatrix>("DistanceMatrix", "The matrix which contains the distances between the points."));
    109107      Parameters.Add(new LookupParameter<DoubleArray>("Scores", "The scores of the points."));
     
    112110      Parameters.Add(new LookupParameter<IntValue>("TerminusPoint", "Index of the ending point."));
    113111      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."));
    115112      Parameters.Add(new ValueLookupParameter<IntValue>("MaximumIterations", "The maximum number of generations which should be processed.", new IntValue(150)));
    116113      Parameters.Add(new LookupParameter<IntValue>("EvaluatedSolutions", "The number of evaluated moves."));
     
    130127
    131128    public override IOperation Apply() {
     129      // TODO Use LocalImprovementorOperator Parameters
     130
    132131      int numPoints = ScoresParameter.ActualValue.Length;
    133132      var distances = DistanceMatrixParameter.ActualValue;
     
    136135
    137136      bool optimizationDone = true;
    138       bool isFeasible = true;
    139137
    140138      // Find the maximum distance restriction
     
    227225          if (optimizationDone) break;
    228226
    229           double detour = distances.CalculateInsertionCost(tour, tourPosition, visitablePoints[i], fixedPenalty);
     227          double detour = distances.CalculateInsertionCosts(tour, tourPosition, visitablePoints[i], fixedPenalty);
    230228
    231229          // Determine if including the point does not violate any constraint
     
    255253          if (optimizationDone) break;
    256254
    257           double detour = distances.CalculateReplacementCost(tour, tourPosition, visitablePoints[i]);
     255          double detour = distances.CalculateReplacementCosts(tour, tourPosition, visitablePoints[i]);
    258256
    259257          double oldPointScore = scores[tour[tourPosition]];
  • branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering/3.3/OrienteeringProblem.cs

    r11191 r11194  
    2929using HeuristicLab.Parameters;
    3030using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    31 using HeuristicLab.PluginInfrastructure;
    3231using HeuristicLab.Problems.Instances;
    3332
     
    246245    private void ParameterizeEvaluator() {
    247246      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;
    251250      }
    252251    }
     
    268267      ParameterizeAnalyzer();
    269268
    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);
    272272      ParameterizeOperators();
    273273    }
    274274    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>()) {
    278276        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      }
    281285    }
    282286    #endregion
Note: See TracChangeset for help on using the changeset viewer.