Changeset 11293


Ignore:
Timestamp:
08/20/14 13:23:50 (5 years ago)
Author:
pfleck
Message:

#2208
Changed selection of neighborhood for shaking operator to a deterministic selection.
This way, neighborhoods won't be visited multiple times during an attempt to escape local optimum.

File:
1 edited

Legend:

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

    r11266 r11293  
    128128      if (initialTour.Length > 2) {
    129129        // Limit the neighborhood to the tour length
    130         int maxNeighborhood = CurrentNeighborhoodIndexParameter.ActualValue.Value + 1;
    131         int limit = initialTour.Length - 2; // neighborhood limit within [0, changable tour length - 1)
    132         int neighborhood = random.Next((limit > maxNeighborhood) ? maxNeighborhood : limit) + 1;
     130        int currentNeighborhood = CurrentNeighborhoodIndexParameter.ActualValue.Value + 1;
     131        int maximumNeighborhood = initialTour.Length - 2; // neighborhood limit within [0, changable tour length - 1)
     132        maximumNeighborhood = (maximumNeighborhood > currentNeighborhood) ? currentNeighborhood : maximumNeighborhood;
     133        int neighborhood = maximumNeighborhood;//random.Next(maximumNeighborhood) + 1;
    133134
    134135        // Find all points that are not yet included in the tour and are
Note: See TracChangeset for help on using the changeset viewer.