Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/14/22 11:37:51 (2 years ago)
Author:
pfleck
Message:

#3040 Added GuidedRangeManipulator for nested index optimization.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3040_VectorBasedGP/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/Manipulators/UniformOnePositionManipulator.cs

    r18233 r18235  
    8585      if (bounds == null || bounds.Rows == 0 || bounds.Columns < 2) throw new ArgumentException("UniformOnePositionManipulator: Invalid bounds specified", "bounds");
    8686      int min = bounds[index % bounds.Rows, 0], max = bounds[index % bounds.Rows, 1], step = 1;
    87       if (min == max) {
     87      if (min == max || min == max - 1) {
    8888        vector[index] = min;
    8989      } else {
     
    9393        // but 99 is not a feasible value, so max needs to be adjusted => min = 0, max = 95
    9494        max = FloorFeasible(min, max, step, max - 1);
    95         if (min == max)
    96           vector[index] = min;
    97         else
    98           vector[index] = RoundFeasible(min, max, step, random.Next(min, max));
     95        vector[index] = RoundFeasible(min, max, step, random.Next(min, max + 1));
    9996      }
    10097    }
Note: See TracChangeset for help on using the changeset viewer.