Skip to content

Commit 93862a6

Browse files
committed
fix: only call RNG in Tabu search when necessary
1 parent a682654 commit 93862a6

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

core/src/main/java/ai/timefold/solver/core/impl/localsearch/decider/acceptor/tabu/AbstractTabuAcceptor.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,11 @@ public boolean isAccepted(LocalSearchMoveScope<Solution_> moveScope) {
141141
logger.trace("{} Proposed move ({}) is tabu and is therefore not accepted.",
142142
logIndentation, moveScope.getMove());
143143
return false;
144+
} else if (workingFadingTabuSize == 0) {
145+
// No comment as the move is not tabu; the tabu list needs to be adjusted.
146+
return true;
144147
}
148+
// From this point, we are guaranteed to be in a fading tabu.
145149
var acceptChance = calculateFadingTabuAcceptChance(tabuStepCount - workingTabuSize);
146150
var accepted = moveScope.getWorkingRandom().nextDouble() < acceptChance;
147151
if (accepted) {

0 commit comments

Comments
 (0)