Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/01/14 10:36:54 (10 years ago)
Author:
pfleck
Message:

#2208 Renamed FixedPenalty to PointVisitingCosts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering/3.3/Shakers/OrienteeringShakingOperator.cs

    r11319 r11320  
    7676      get { return (ILookupParameter<DoubleArray>)Parameters["Scores"]; }
    7777    }
    78     public ILookupParameter<DoubleValue> FixedPenaltyParameter {
    79       get { return (ILookupParameter<DoubleValue>)Parameters["FixedPenalty"]; }
     78    public ILookupParameter<DoubleValue> PointVisitingCostsParameter {
     79      get { return (ILookupParameter<DoubleValue>)Parameters["PointVisitingCosts"]; }
    8080    }
    8181
     
    101101      Parameters.Add(new LookupParameter<DistanceMatrix>("DistanceMatrix", "The matrix which contains the distances between the points."));
    102102      Parameters.Add(new LookupParameter<DoubleArray>("Scores", "The scores of the points."));
    103       Parameters.Add(new LookupParameter<DoubleValue>("FixedPenalty", "The penalty for each visited vertex."));
     103      Parameters.Add(new LookupParameter<DoubleValue>("PointVisitingCosts", "The costs for visiting a point."));
    104104
    105105      Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator that will be used."));
     
    116116      var startingPoint = StartingPointParameter.ActualValue.Value;
    117117      var terminalPoint = TerminalPointParameter.ActualValue.Value;
    118       var fixedPenalty = FixedPenaltyParameter.ActualValue.Value;
     118      var pointVisitingCosts = PointVisitingCostsParameter.ActualValue.Value;
    119119      double maxDistance = MaximumDistanceParameter.ActualValue.Value;
    120120      int numPoints = scores.Length;
     
    139139          from point in Enumerable.Range(0, numPoints)
    140140          // 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, terminalPoint] + fixedPenalty
     141          let distance = distances[startingPoint, point] + distances[point, terminalPoint] + pointVisitingCosts
    142142          // If this distance is feasible and the point is neither starting nor ending point, check the point
    143143          where distance < maxDistance && point != startingPoint && point != terminalPoint
     
    157157
    158158        // Bring the tour back to be feasible
    159         CleanupTour(actualTour, distances, maxDistance, fixedPenalty);
     159        CleanupTour(actualTour, distances, maxDistance, pointVisitingCosts);
    160160
    161161        // Set new Tour
     
    208208      }
    209209    }
    210     private void CleanupTour(List<int> actualTour, DistanceMatrix distances, double maxDistance, double fixedPenalty) {
     210    private void CleanupTour(List<int> actualTour, DistanceMatrix distances, double maxDistance, double pointVisitingCosts) {
    211211      // Sort the points on the tour according to their costs savings when removed
    212212      var distanceSavings = (
    213213        from removePosition in Enumerable.Range(1, actualTour.Count - 2)
    214         let saving = distances.CalculateRemovementSaving(actualTour, removePosition, fixedPenalty)
     214        let saving = distances.CalculateRemovementSaving(actualTour, removePosition, pointVisitingCosts)
    215215        orderby saving descending
    216216        select new SavingInfo { Index = removePosition, Saving = saving }
    217217      ).ToList();
    218218
    219       double tourLength = distances.CalculateTourLength(actualTour, fixedPenalty);
     219      double tourLength = distances.CalculateTourLength(actualTour, pointVisitingCosts);
    220220
    221221      // As long as the created path is infeasible, remove elements
     
    223223        // Remove the point that frees the largest distance
    224224        // Note, distance savings are not updated after removal
    225         tourLength -= distances.CalculateRemovementSaving(actualTour, distanceSavings[0].Index, fixedPenalty);
     225        tourLength -= distances.CalculateRemovementSaving(actualTour, distanceSavings[0].Index, pointVisitingCosts);
    226226        actualTour.RemoveAt(distanceSavings[0].Index);
    227227
Note: See TracChangeset for help on using the changeset viewer.