Skip to content

fix: invert the probability of acceptance in fading tabu#2358

Open
triceo wants to merge 4 commits into
TimefoldAI:mainfrom
triceo:tabu
Open

fix: invert the probability of acceptance in fading tabu#2358
triceo wants to merge 4 commits into
TimefoldAI:mainfrom
triceo:tabu

Conversation

@triceo

@triceo triceo commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

The closer the item is to becoming non-tabu, the higher should its acceptance probability be. (This has been a long-standing bug which went unnoticed.)

Also made sure that, when the chance is 0 or 1, that the RNG is not called. RNG is expensive, and it affects randomness in other places of the solver that use the same RNG.

Copilot AI review requested due to automatic review settings June 11, 2026 09:56
@triceo triceo requested a review from zepfred as a code owner June 11, 2026 09:56
@triceo

triceo commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator Author

No need for Fred to review; Chris knows what this is about.

@triceo triceo self-assigned this Jun 11, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to prevent deterministic fading-tabu accept/reject decisions from unnecessarily consuming RNG state during local search tabu acceptance.

Changes:

  • Introduce a helper method that only calls nextDouble() when 0.0 < acceptChance < 1.0.
  • Refactor fading-tabu acceptance logic to delegate RNG usage to the helper.

@triceo triceo marked this pull request as draft June 11, 2026 10:17
@triceo

triceo commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator Author

The logic is wrong, taking it back to draft.

@triceo triceo marked this pull request as ready for review June 11, 2026 13:50
Copilot AI review requested due to automatic review settings June 11, 2026 13:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

@triceo triceo changed the title fix: only call RNG in Tabu search when necessary fix: invert the probability of acceptance in fading tabu Jun 12, 2026
triceo and others added 3 commits June 12, 2026 09:38
…d else-if

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 12, 2026 07:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.

Copilot AI review requested due to automatic review settings June 12, 2026 08:21
@triceo triceo added this to the v2.3.0 milestone Jun 12, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Comment on lines +187 to +191
private FadingTabuDecision decideFadingTabuAcceptance(LocalSearchMoveScope<Solution_> moveScope, int fadingTabuStepCount) {
// Invert the chance; the longer the element is in the tabu list, the higher the chance should be.
var numerator = workingFadingTabuSize - fadingTabuStepCount;
if (numerator <= 0) { // The inverted chance would be >= 1.
return FadingTabuDecision.CERTAIN;
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants