Replies: 1 comment
-
|
Thanks for reporting! This has likely been solved already (see f52d936) and will be released in Solver 2.2.0 next week or so. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm getting an IndexOutOfBoundsException when using a custom neighborhood move in Timefold Solver. The error occurs during the local search phase inside BiRandomMoveIterator.pickNextMove().
Stack trace:
java.lang.IndexOutOfBoundsException: The index (50) must be >= 0 and < size (50). at ai.timefold.solver.core.impl.util.ElementAwareArrayList.getEntry(ElementAwareArrayList.java:66) at ai.timefold.solver.core.impl.util.ElementAwareArrayList.get(ElementAwareArrayList.java:112) at ai.timefold.solver.core.impl.bavet.common.index.DefaultUniqueRandomIterator.hasNext(DefaultUniqueRandomIterator.java:62) at ai.timefold.solver.core.impl.bavet.common.index.FilteredUniqueRandomIterator.hasNext(FilteredUniqueRandomIterator.java:40) at ai.timefold.solver.core.impl.neighborhood.stream.BiRandomMoveIterator.pickNextMove(BiRandomMoveIterator.java:109) at ai.timefold.solver.core.impl.neighborhood.stream.BiRandomMoveIterator.hasNext(BiRandomMoveIterator.java:85) ... at ai.timefold.solver.core.impl.localsearch.DefaultLocalSearchPhase.solve(...)Version:
Timefold Solver 2.1
Configuration:
I am using a custom neighborhood move selector similar to:
`
NEIGHBORHOODS
Observation:
The error occurs when the list size is exactly 50, and the code tries to access index 50 (which is out of bounds, as valid indices are 0–49)
This suggests an off-by-one error in how DefaultUniqueRandomIterator or ElementAwareArrayList handles the upper bound when generating random indices for custom neighborhoods
The error appears during hasNext() / next() iteration over random moves
Question:
Is this a known bug with BiRandomMoveIterator and custom neighborhoods when the collection size is equal to the requested index? Is there a workaround or fix available? Should I avoid certain patterns in custom neighborhood definitions?
Thank you.
Please fill in:
Exact Timefold version
Whether you're using XML config, Java API, or constraint streams
Minimal code/config snippet of your custom neighborhood (if possible)
Beta Was this translation helpful? Give feedback.
All reactions