Changeset 11237


Ignore:
Timestamp:
07/30/14 12:46:32 (7 years ago)
Author:
pfleck
Message:

#2208 fixed bug in score calculation and used quality parameter

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering/3.3/Improvers/OrienteeringLocalImprovementOperator.cs

    r11228 r11237  
    9393    }
    9494    #endregion
     95    public ILookupParameter<DoubleValue> QualityParameter {
     96      get { return (ILookupParameter<DoubleValue>)Parameters["Quality"]; }
     97    }
    9598    #endregion
    9699
     
    114117      Parameters.Add(new LookupParameter<IntValue>("EvaluatedSolutions", "The number of evaluated moves."));
    115118      Parameters.Add(new LookupParameter<ResultCollection>("Results", "The name of the collection where the results are stored."));
     119      Parameters.Add(new LookupParameter<DoubleValue>("Quality", "The quality value of the solution."));
    116120    }
    117121
     
    146150        // Determine if any of the visitable points can be included at any position within the tour
    147151        IncludeNewPoints(tour, visitablePoints,
    148           distances, fixedPenalty, maxLength,
    149           ref tourLength, ref optimizationDone);
     152          distances, fixedPenalty, maxLength, scores,
     153          ref tourLength, ref tourScore, ref optimizationDone);
    150154
    151155        // Determine if any of the visitable points can take the place of an already visited point in the tour to improve the scores
     
    157161      // Set new tour
    158162      IntegerVectorParameter.ActualValue = new IntegerVector(tour.ToArray());
     163      QualityParameter.ActualValue.Value = tourScore;
    159164
    160165      return base.Apply();
     
    201206    }
    202207    private void IncludeNewPoints(List<int> tour, List<int> visitablePoints,
    203       DistanceMatrix distances, double fixedPenalty, double maxLength,
    204       ref double tourLength, ref bool optimizationDone) {
     208      DistanceMatrix distances, double fixedPenalty, double maxLength, DoubleArray scores,
     209      ref double tourLength, ref double tourScore, ref bool optimizationDone) {
    205210
    206211      for (int tourPosition = 1; tourPosition < tour.Count; tourPosition++) {
     
    219224            tour.Insert(tourPosition, visitablePoints[i]);
    220225
    221             // Update the overall tour tourLength
     226            // Update the overall tour tourLength and score
    222227            tourLength += detour;
     228            tourScore += scores[visitablePoints[i]];
    223229
    224230            // Re-run this optimization
Note: See TracChangeset for help on using the changeset viewer.