Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ensure entity placer is not shared in ruin and recreate moves #1320

Merged
merged 14 commits into from
Jan 15, 2025

Conversation

zepfred
Copy link
Contributor

@zepfred zepfred commented Jan 13, 2025

Fixes TimefoldAI/timefold-employee-scheduling#305

Copy link
Contributor

@triceo triceo left a comment

Choose a reason for hiding this comment

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

So what was the problem after all? I only see the changes we talked about - yet that version didn't work yet. So, what changed?

Let's discuss the custom actions on Slack.

Left a few more comments, but otherwise LGTM.

@zepfred
Copy link
Contributor Author

zepfred commented Jan 15, 2025

So what was the problem after all? I only see the changes we talked about - yet that version didn't work yet. So, what changed?

constructionHeuristicPhaseBuilder is shared among all threads. Therefore, every time a thread builds the R&R phase, it updates the reference elementsToRecreate, which filters out non-ruined elements. Additionally, the entity placer and decider are both shared. When a main thread executes a chosen move, it utilizes the same decider, leading to the CH phase in move threads ending prematurely and not reassigning the ruined elements.

In short, constructionHeuristicPhaseBuilder was causing race conditions, and constructionHeuristicPhaseBuilder#ensureThreadSafe() fixes that.

Copy link
Contributor

@triceo triceo left a comment

Choose a reason for hiding this comment

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

LGTM after comments resolved and CI green.

@triceo triceo merged commit 3247e86 into TimefoldAI:main Jan 15, 2025
28 checks passed
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.

fix: Ruin and Recreate index out of bound
2 participants