-
Notifications
You must be signed in to change notification settings - Fork 24
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
Legacy ortools behind API - user story 3.1 #2455
base: develop
Are you sure you want to change the base?
Conversation
Quality Gate passedIssues Measures |
…lver prevents solver from being shared among weeks
|
||
private: | ||
OrtoolsMipVariable* addVariable(double lb, double ub, bool integer, const std::string& name); | ||
|
||
std::shared_ptr<operations_research::MPSolver> mpSolver_; | ||
operations_research::MPSolver* mpSolver_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you can see, mpSolver_ is no longer a shared pointer, at least for now.
The reason is that current Antares code (where the ortools solver are called) is made in such a way that the solver must be shared between optimization and weeks.
So a solver cannot be destroyed too soon, it has to be persistent.
It's planned to handle the life time in the future.
auto ortoolsProblem = std::make_unique<OrtoolsLinearProblem>(Probleme.isMIP(), options.ortoolsSolver); | ||
auto legacyOrtoolsFiller = std::make_unique<LegacyOrtoolsFiller>(ortoolsProblem->MPSolver(), &Probleme); | ||
std::vector<LinearProblemFiller*> fillersCollection = {legacyOrtoolsFiller.get()}; | ||
LinearProblemData LP_Data; | ||
LinearProblemBuilder linearProblemBuilder(fillersCollection); | ||
|
||
linearProblemBuilder.build(*ortoolsProblem, LP_Data); | ||
auto MPproblem = std::shared_ptr<MPSolver>(ortoolsProblem->MPSolver()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This block appears twice in this file.
It is meant to create a ortools MPSolver.
It's a kind of code duplication.
This duplication will be removed in a further PR
Do not merge with changes on CI yaml files
What we plan to do :
More specifically, we replace the current ortools LP building with a use :
--use-ortools --ortools-solver sirius
Notes :
--use-ortools --ortools-solver sirius
in the CI. We can spot the expected regressions.