Free cookie consent management tool by TermsFeed Policy Generator

Opened 3 years ago

#3148 new defect

UniformOnePositionManipulator throws Exception if only a single value is allowed

Reported by: pfleck Owned by: abeham
Priority: medium Milestone:
Component: Encodings.IntegerVectorEncoding Version:
Keywords: Cc:

Description

If the bounds for an UniformOnePositionManipulator limits the value range to a single, admissible value, an Exception is thrown.

This is caused in lines 94-95 in UniformOnePositionManipulator.cs, that were introduced in r8790:

max = FloorFeasible(min, max, step, max - 1);
vector[index] = RoundFeasible(min, max, step, random.Next(min, max));

For instance, the bounds [0, 1[ allowing only allow 0 as value, causes min and max to be 0, causing an exception when calling random.Next(min, max).

I guess, the min == max check in line 88 could be used after adapting the upper bound.

Change History (0)

Note: See TracTickets for help on using tickets.