Free cookie consent management tool by TermsFeed Policy Generator

Changeset 11264 for branches


Ignore:
Timestamp:
08/04/14 15:04:58 (10 years ago)
Author:
pfleck
Message:

#2208 Fixed random index calculation bug in shaking operator

File:
1 edited

Legend:

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

    r11245 r11264  
    129129        // Limit the neighborhood to the tour length
    130130        int maxNeighborhood = CurrentNeighborhoodIndexParameter.ActualValue.Value + 1;
    131         int limit = initialTour.Length - 3; // neighborhood limit within [0, length-1)
     131        int limit = initialTour.Length - 2; // neighborhood limit within [0, changable tour length - 1)
    132132        int neighborhood = random.Next((limit > maxNeighborhood) ? maxNeighborhood : limit) + 1;
    133133
     
    169169      // Elect the starting index of the part to be replaced
    170170      int tourSize = initialTour.Length;
    171       int randomPosition = random.Next(tourSize - neighborhood - 2) + 1;
     171      int randomPosition = random.Next(tourSize - neighborhood - 1) + 1;
    172172
    173173      for (int position = 1; position < tourSize; position++) {
Note: See TracChangeset for help on using the changeset viewer.