-
Notifications
You must be signed in to change notification settings - Fork 25
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
Solver : add options for optim 1 and 2 #2672
base: feature/new_quad_solvers
Are you sure you want to change the base?
Solver : add options for optim 1 and 2 #2672
Conversation
…n with a misleading name
@@ -98,6 +98,22 @@ std::unique_ptr<Yuni::GetOpt::Parser> CreateParser(Settings& settings, StudyLoad | |||
"solver-parameters", | |||
"Deprecated, use linear-solver-parameters instead."); | |||
|
|||
// --lp-solver-param-optim-1 |
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.
don't forget to add the same information to the CLI doc on the website
// TODO : this function is too long and has a bad name. | ||
// TODO : we should split it into (at least) 4 functions. | ||
// TODO : Naming will be easier. | ||
void Application::readStudy_makeChecks_and_printThings(Data::StudyLoadOptions& options) |
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.
Quickly rename this function with a less misleading name, though imperfect.
Previous name was not good at all. This one is long but more accurate.
As specified in comment, we should split this function.
@@ -70,7 +70,7 @@ SimulationResults APIInternal::execute( | |||
|
|||
Settings settings; | |||
auto& parameters = study_->parameters; | |||
parameters.optOptions = optOptions; | |||
parameters.optOptions << optOptions; |
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.
parameters.optOptions = optOptions;
is replaced with :
parameters.optOptions << optOptions;
I suppose that existing operator<< is meant to be used here.
@pet-mit : as you introduced this operator, what do you think ?
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.
ok for <<
, it seems more coherent with CLI use
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.
What does this operator<<
do specifically ?
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.
Please see with @pet-mit, its his.
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.
following @guilpier-code 's proposal on this PR, this operator overrides all fields of the optimization options, except for the logs flag, on which it operates a logical OR (code here)
@@ -20,7 +20,6 @@ | |||
*/ | |||
|
|||
#include <antares/checks/checkLoadedInputData.h> | |||
#include <antares/exception/InitializationError.hpp> |
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.
#include <antares/exception/InitializationError.hpp>
was never used here. We remove it.
// Return false if the user requested the version ,available solvers, etc, true otherwise | ||
bool handleOptions(const Data::StudyLoadOptions& options); | ||
// Return false if the user requested help, true otherwise | ||
bool parseCommandLine(Data::StudyLoadOptions& options); | ||
void handleParserReturn(Yuni::GetOpt::Parser* parser); |
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.
void handleParserReturn(Yuni::GetOpt::Parser* parser);
is declared but has never been defined or used. We remove it.
|
… in "generaldata.ini" parameters unit tests.
… consistency + post-treat solver options
…the optimization number.
@@ -70,7 +70,7 @@ SimulationResults APIInternal::execute( | |||
|
|||
Settings settings; | |||
auto& parameters = study_->parameters; | |||
parameters.optOptions = optOptions; | |||
parameters.optOptions << optOptions; |
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.
What does this operator<<
do specifically ?
bool found = std::ranges::find(availableSolversList, solverName) != availableSolversList.end(); | ||
if (!found) | ||
{ | ||
throw Error::InvalidSolver(solverName, boost::algorithm::join(availableSolversList, ",")); |
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.
there is already a function just for that, no need to add new code (boost::algorithm::join)
std::string availableOrToolsSolversString();
@@ -262,6 +262,7 @@ bool OPT_OptimisationLineaire(const OptimizationOptions& options, | |||
OPT_ExportStructures(problemeHebdo, writer); | |||
} | |||
|
|||
options.linearSolverParameters = options.lpSolverParamOptim1; |
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 is bad. Don't let OPT_OptimisationLineaire
change it's options. What's more options
is unique (unique like in "not options[numSpace]
"), so we'll encounter race conditions in parallel simulations.
One solution is to add methods on this structure
OptimizationOptions opt1 = options.getOptionsOptim1()
OptimizationOptions opt2 = options.getOptionsOptim2()
But then you need to clarify the role of OptimizationOptions
, and maybe create a new class to retain the options in general (excluding optimization 1 & 2).
// Options for a single optimization
class SingleOptOptions
{
};
class OptimizationOptions
{
SingleOptOptions getOptionsOptim1();
SingleOptOptions getOptionsOptim2();
};
// ...
return runWeeklyOptimization(options.getOptionsOptim2(),
problemeHebdo,
writer,
DEUXIEME_OPTIMISATION,
simulationObserver);
WDYT ?
Fixes ANT-2753.
What is done eventually :
--lp-solver-param-optim-1
and--lp-solver-param-optim-2