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

Apply heuristics for partial solutions #1177

Open
wants to merge 34 commits into
base: master
Choose a base branch
from

Conversation

jcoupey
Copy link
Collaborator

@jcoupey jcoupey commented Oct 29, 2024

Issue

Fixes #977, fixes #1181.

Tasks

  • Refactor initial solution setup to happen prior to heuristic application
  • Update basic heuristic to account for non-empty routes in input
  • Update dynamic heuristic to account for non-empty routes in input
  • Move generating unassigned jobs for basic and dynamic heuristics into a single helper function
  • Move seeding logic for basic and dynamic heuristics into a single helper function
  • Update CHANGELOG.md
  • review

@jcoupey
Copy link
Collaborator Author

jcoupey commented Nov 13, 2024

I've tested things related to #977 as follows:

  • generate optimized routes for a set of random instances;
  • remove various fractions of the routes to generate a set of initial solutions that are more or less "complete";
  • solve with partial solution in input.

Compared to master, this PR yields much better solutions as expected since applying heuristics to partial solutions broadens the search. In particular in many situations, master is unable to assign all tasks back when starting with a single local search on the partial solution, while PR does reach to "full" solutions with no unassigned task. When solutions are full on both sides, PR reaches smaller cost solutions.

Also I've generated specific instances to reproduce the embarrassing situations mentioned here in order to confirm that this PR does fix it.

@jcoupey
Copy link
Collaborator Author

jcoupey commented Nov 13, 2024

Now for the refactoring part from #1181, this PR significantly reduces the number of lines and heuristic stuff is now much more readable.

I've confirmed that we still get the exact same executions and searches on the usual benchmarks. The caveat being that I've notice a slight slowdown for the heuristics computing. I've done some profiling but I have no explanation other than the fact that the core heuristic parts are now factored in helper functions. Those seem to be inlined by the compiler but probably the added boilerplate prevent some further optimization that was happening before.

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

Successfully merging this pull request may close these issues.

Code deduplication in heuristics Applying heuristics to partial solutions provided in input
1 participant