From 225c7a81f60a899ec63f6d012cfaffbd6d63baa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Omn=C3=A8s?= Date: Mon, 2 Dec 2024 12:46:16 +0100 Subject: [PATCH 1/6] Rename thread_number -> numSpace for consistency (#2515) Even though numSpace isn't a great name, we should stick to it for consistency. Otherwise it's confusing. --- .../adq_patch_post_process_list.cpp | 12 +++++----- .../adq_patch_post_process_list.h | 2 +- .../optimisation/optim_post_process_list.h | 2 +- .../optimisation/post_process_commands.h | 16 ++++++------- .../optimisation/optim_post_process_list.cpp | 8 +++---- .../optimisation/post_process_commands.cpp | 24 +++++++++---------- src/solver/simulation/base_post_process.cpp | 8 +++---- .../solver/simulation/base_post_process.h | 6 ++--- 8 files changed, 39 insertions(+), 39 deletions(-) diff --git a/src/solver/optimisation/adequacy_patch_csr/adq_patch_post_process_list.cpp b/src/solver/optimisation/adequacy_patch_csr/adq_patch_post_process_list.cpp index 996ec70c6e..1d54cb0da0 100644 --- a/src/solver/optimisation/adequacy_patch_csr/adq_patch_post_process_list.cpp +++ b/src/solver/optimisation/adequacy_patch_csr/adq_patch_post_process_list.cpp @@ -27,15 +27,15 @@ namespace Antares::Solver::Simulation { AdqPatchPostProcessList::AdqPatchPostProcessList(const AdqPatchParams& adqPatchParams, PROBLEME_HEBDO* problemeHebdo, - uint thread_number, + uint numSpace, AreaList& areas, SheddingPolicy sheddingPolicy, SimplexOptimization splxOptimization, Calendar& calendar): - interfacePostProcessList(problemeHebdo, thread_number) + interfacePostProcessList(problemeHebdo, numSpace) { post_process_list.push_back( - std::make_unique(problemeHebdo_, thread_number_, areas)); + std::make_unique(problemeHebdo_, numSpace_, areas)); post_process_list.push_back( std::make_unique(problemeHebdo_, areas, false, false)); @@ -43,16 +43,16 @@ AdqPatchPostProcessList::AdqPatchPostProcessList(const AdqPatchParams& adqPatchP areas, sheddingPolicy, splxOptimization, - thread_number)); + numSpace)); // Here a post process particular to adq patch post_process_list.push_back(std::make_unique(adqPatchParams, problemeHebdo_, areas, - thread_number_)); + numSpace_)); // Here a post process particular to adq patch post_process_list.push_back( - std::make_unique(problemeHebdo_, areas, thread_number)); + std::make_unique(problemeHebdo_, areas, numSpace)); post_process_list.push_back( std::make_unique(problemeHebdo_, areas, true, false)); post_process_list.push_back( diff --git a/src/solver/optimisation/include/antares/solver/optimisation/adequacy_patch_csr/adq_patch_post_process_list.h b/src/solver/optimisation/include/antares/solver/optimisation/adequacy_patch_csr/adq_patch_post_process_list.h index cba4657fb2..d73ce8cfd2 100644 --- a/src/solver/optimisation/include/antares/solver/optimisation/adequacy_patch_csr/adq_patch_post_process_list.h +++ b/src/solver/optimisation/include/antares/solver/optimisation/adequacy_patch_csr/adq_patch_post_process_list.h @@ -34,7 +34,7 @@ class AdqPatchPostProcessList: public interfacePostProcessList public: AdqPatchPostProcessList(const AdqPatchParams& adqPatchParams, PROBLEME_HEBDO* problemeHebdo, - uint thread_number, + uint numSpace, AreaList& areas, SheddingPolicy sheddingPolicy, SimplexOptimization splxOptimization, diff --git a/src/solver/optimisation/include/antares/solver/optimisation/optim_post_process_list.h b/src/solver/optimisation/include/antares/solver/optimisation/optim_post_process_list.h index eecd9edfba..833a556db1 100644 --- a/src/solver/optimisation/include/antares/solver/optimisation/optim_post_process_list.h +++ b/src/solver/optimisation/include/antares/solver/optimisation/optim_post_process_list.h @@ -29,7 +29,7 @@ class OptPostProcessList: public interfacePostProcessList { public: OptPostProcessList(PROBLEME_HEBDO* problemeHebdo, - uint thread_number, + uint numSpace, AreaList& areas, SheddingPolicy sheddingPolicy, SimplexOptimization splxOptimization, diff --git a/src/solver/optimisation/include/antares/solver/optimisation/post_process_commands.h b/src/solver/optimisation/include/antares/solver/optimisation/post_process_commands.h index 5bf5ecf314..4c3fd49bd1 100644 --- a/src/solver/optimisation/include/antares/solver/optimisation/post_process_commands.h +++ b/src/solver/optimisation/include/antares/solver/optimisation/post_process_commands.h @@ -28,12 +28,12 @@ class DispatchableMarginPostProcessCmd: public basePostProcessCommand { public: DispatchableMarginPostProcessCmd(PROBLEME_HEBDO* problemeHebdo, - unsigned int thread_number, + unsigned int numSpace, AreaList& areas); void execute(const optRuntimeData& opt_runtime_data) override; private: - unsigned int thread_number_ = 0; + unsigned int numSpace_ = 0; const AreaList& area_list_; }; @@ -59,12 +59,12 @@ class RemixHydroPostProcessCmd: public basePostProcessCommand AreaList& areas, SheddingPolicy sheddingPolicy, SimplexOptimization simplexOptimization, - unsigned int thread_number); + unsigned int numSpace); void execute(const optRuntimeData& opt_runtime_data) override; private: const AreaList& area_list_; - unsigned int thread_number_ = 0; + unsigned int numSpace_ = 0; SheddingPolicy shedding_policy_; SimplexOptimization splx_optimization_; }; @@ -76,13 +76,13 @@ class DTGmarginForAdqPatchPostProcessCmd: public basePostProcessCommand public: DTGmarginForAdqPatchPostProcessCmd(PROBLEME_HEBDO* problemeHebdo, AreaList& areas, - unsigned int thread_number); + unsigned int numSpace); void execute(const optRuntimeData& opt_runtime_data) override; private: const AreaList& area_list_; - unsigned int thread_number_ = 0; + unsigned int numSpace_ = 0; }; class InterpolateWaterValuePostProcessCmd: public basePostProcessCommand @@ -118,7 +118,7 @@ class CurtailmentSharingPostProcessCmd: public basePostProcessCommand CurtailmentSharingPostProcessCmd(const AdqPatchParams& adqPatchParams, PROBLEME_HEBDO* problemeHebdo, AreaList& areas, - unsigned int thread_number); + unsigned int numSpace); void execute(const optRuntimeData& opt_runtime_data) override; @@ -130,7 +130,7 @@ class CurtailmentSharingPostProcessCmd: public basePostProcessCommand const AreaList& area_list_; const AdqPatchParams& adqPatchParams_; - unsigned int thread_number_ = 0; + unsigned int numSpace_ = 0; }; } // namespace Antares::Solver::Simulation diff --git a/src/solver/optimisation/optim_post_process_list.cpp b/src/solver/optimisation/optim_post_process_list.cpp index a9eb38f7e8..9f52a11ac1 100644 --- a/src/solver/optimisation/optim_post_process_list.cpp +++ b/src/solver/optimisation/optim_post_process_list.cpp @@ -26,24 +26,24 @@ namespace Antares::Solver::Simulation { OptPostProcessList::OptPostProcessList(PROBLEME_HEBDO* problemeHebdo, - uint thread_number, + uint numSpace, AreaList& areas, SheddingPolicy sheddingPolicy, SimplexOptimization splxOptimization, Calendar& calendar) : - interfacePostProcessList(problemeHebdo, thread_number) + interfacePostProcessList(problemeHebdo, numSpace) { post_process_list.push_back( - std::make_unique(problemeHebdo_, thread_number_, areas)); + std::make_unique(problemeHebdo_, numSpace_, areas)); post_process_list.push_back( std::make_unique(problemeHebdo_, areas, false, false)); post_process_list.push_back(std::make_unique(problemeHebdo_, areas, sheddingPolicy, splxOptimization, - thread_number)); + numSpace)); post_process_list.push_back( std::make_unique(problemeHebdo_, areas, true, false)); post_process_list.push_back( diff --git a/src/solver/optimisation/post_process_commands.cpp b/src/solver/optimisation/post_process_commands.cpp index 7ca5a4b0d5..b069050960 100644 --- a/src/solver/optimisation/post_process_commands.cpp +++ b/src/solver/optimisation/post_process_commands.cpp @@ -34,10 +34,10 @@ const uint nbHoursInWeek = 168; // Dispatchable Margin // ----------------------------- DispatchableMarginPostProcessCmd::DispatchableMarginPostProcessCmd(PROBLEME_HEBDO* problemeHebdo, - unsigned int thread_number, + unsigned int numSpace, AreaList& areas): basePostProcessCommand(problemeHebdo), - thread_number_(thread_number), + numSpace_(numSpace), area_list_(areas) { } @@ -49,7 +49,7 @@ void DispatchableMarginPostProcessCmd::execute(const optRuntimeData& opt_runtime area_list_.each( [this, &hourInYear, &year](Data::Area& area) { - double* dtgmrg = area.scratchpad[thread_number_].dispatchableGenerationMargin; + double* dtgmrg = area.scratchpad[numSpace_].dispatchableGenerationMargin; for (uint h = 0; h != nbHoursInWeek; ++h) { dtgmrg[h] = 0.; @@ -96,10 +96,10 @@ RemixHydroPostProcessCmd::RemixHydroPostProcessCmd(PROBLEME_HEBDO* problemeHebdo AreaList& areas, SheddingPolicy sheddingPolicy, SimplexOptimization simplexOptimization, - unsigned int thread_number): + unsigned int numSpace): basePostProcessCommand(problemeHebdo), area_list_(areas), - thread_number_(thread_number), + numSpace_(numSpace), shedding_policy_(sheddingPolicy), splx_optimization_(simplexOptimization) { @@ -112,7 +112,7 @@ void RemixHydroPostProcessCmd::execute(const optRuntimeData& opt_runtime_data) *problemeHebdo_, shedding_policy_, splx_optimization_, - thread_number_, + numSpace_, hourInYear); } @@ -124,10 +124,10 @@ using namespace Antares::Data::AdequacyPatch; DTGmarginForAdqPatchPostProcessCmd::DTGmarginForAdqPatchPostProcessCmd( PROBLEME_HEBDO* problemeHebdo, AreaList& areas, - unsigned int thread_number): + unsigned int numSpace): basePostProcessCommand(problemeHebdo), area_list_(areas), - thread_number_(thread_number) + numSpace_(numSpace) { } @@ -147,7 +147,7 @@ void DTGmarginForAdqPatchPostProcessCmd::execute(const optRuntimeData&) for (uint hour = 0; hour < nbHoursInWeek; hour++) { auto& hourlyResults = problemeHebdo_->ResultatsHoraires[Area]; - const auto& scratchpad = area_list_[Area]->scratchpad[thread_number_]; + const auto& scratchpad = area_list_[Area]->scratchpad[numSpace_]; const double dtgMrg = scratchpad.dispatchableGenerationMargin[hour]; const double ens = hourlyResults.ValeursHorairesDeDefaillancePositive[hour]; const bool triggered = problemeHebdo_->adequacyPatchRuntimeData @@ -211,11 +211,11 @@ CurtailmentSharingPostProcessCmd::CurtailmentSharingPostProcessCmd( const AdqPatchParams& adqPatchParams, PROBLEME_HEBDO* problemeHebdo, AreaList& areas, - unsigned int thread_number): + unsigned int numSpace): basePostProcessCommand(problemeHebdo), area_list_(areas), adqPatchParams_(adqPatchParams), - thread_number_(thread_number) + numSpace_(numSpace) { } @@ -256,7 +256,7 @@ double CurtailmentSharingPostProcessCmd::calculateDensNewAndTotalLmrViolation() // adjust densNew according to the new specification/request by ELIA /* DENS_new (node A) = max [ 0; ENS_init (node A) + net_position_init (node A) + ? flows (node 1 -> node A) - DTG.MRG(node A)] */ - const auto& scratchpad = area_list_[Area]->scratchpad[thread_number_]; + const auto& scratchpad = area_list_[Area]->scratchpad[numSpace_]; double dtgMrg = scratchpad.dispatchableGenerationMargin[hour]; // write down densNew values for all the hours problemeHebdo_->ResultatsHoraires[Area].ValeursHorairesDENS[hour] = std::max( diff --git a/src/solver/simulation/base_post_process.cpp b/src/solver/simulation/base_post_process.cpp index 4cd7bb8cf9..d3c2da7f3c 100644 --- a/src/solver/simulation/base_post_process.cpp +++ b/src/solver/simulation/base_post_process.cpp @@ -36,14 +36,14 @@ basePostProcessCommand::basePostProcessCommand(PROBLEME_HEBDO* problemeHebdo): interfacePostProcessList::interfacePostProcessList(PROBLEME_HEBDO* problemesHebdo, uint numSpace): problemeHebdo_(problemesHebdo), - thread_number_(numSpace) + numSpace_(numSpace) { } std::unique_ptr interfacePostProcessList::create( AdqPatchParams& adqPatchParams, PROBLEME_HEBDO* problemeHebdo, - uint thread_number, + uint numSpace, AreaList& areas, SheddingPolicy sheddingPolicy, SimplexOptimization splxOptimization, @@ -53,7 +53,7 @@ std::unique_ptr interfacePostProcessList::create( { return std::make_unique(adqPatchParams, problemeHebdo, - thread_number, + numSpace, areas, sheddingPolicy, splxOptimization, @@ -62,7 +62,7 @@ std::unique_ptr interfacePostProcessList::create( else { return std::make_unique(problemeHebdo, - thread_number, + numSpace, areas, sheddingPolicy, splxOptimization, diff --git a/src/solver/simulation/include/antares/solver/simulation/base_post_process.h b/src/solver/simulation/include/antares/solver/simulation/base_post_process.h index 6918fb85d3..f1e6215415 100644 --- a/src/solver/simulation/include/antares/solver/simulation/base_post_process.h +++ b/src/solver/simulation/include/antares/solver/simulation/base_post_process.h @@ -71,7 +71,7 @@ class interfacePostProcessList // gp : the constructors' signatures of the post process list classes. static std::unique_ptr create(AdqPatchParams& adqPatchParams, PROBLEME_HEBDO* problemeHebdo, - uint thread_number, + uint numSpace, AreaList& areas, SheddingPolicy sheddingPolicy, SimplexOptimization splxOptimization, @@ -80,11 +80,11 @@ class interfacePostProcessList protected: // Member functions - interfacePostProcessList(PROBLEME_HEBDO* problemeHebdo, uint thread_number); + interfacePostProcessList(PROBLEME_HEBDO* problemeHebdo, uint numSpace); // Data mambers PROBLEME_HEBDO* const problemeHebdo_ = nullptr; - const unsigned int thread_number_ = 0; + const unsigned int numSpace_; std::vector> post_process_list; }; From 6f017c664581d90b7394a80a7ed998023bce8313 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Omn=C3=A8s?= Date: Mon, 2 Dec 2024 20:34:15 +0100 Subject: [PATCH 2/6] Fix variable bounds for 1st week in the year (#2517) See function `ORTOOLS_CorrigerLesBornes`. --- src/solver/optimisation/LegacyFiller.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/solver/optimisation/LegacyFiller.cpp b/src/solver/optimisation/LegacyFiller.cpp index 7cbcaff820..c1f2f7edcb 100644 --- a/src/solver/optimisation/LegacyFiller.cpp +++ b/src/solver/optimisation/LegacyFiller.cpp @@ -46,9 +46,18 @@ void LegacyFiller::CopyMatrix(ILinearProblem& pb) const void LegacyFiller::CreateVariable(unsigned idxVar, ILinearProblem& pb) const { - double min_l = problemeSimplexe_->Xmin[idxVar]; - double max_l = problemeSimplexe_->Xmax[idxVar]; - bool isIntegerVariable = problemeSimplexe_->IntegerVariable(idxVar); + const double bMin = problemeSimplexe_->Xmin[idxVar]; + const double bMax = problemeSimplexe_->Xmax[idxVar]; + const int typeVar = problemeSimplexe_->TypeDeVariable[idxVar]; + + double min_l = (typeVar == VARIABLE_NON_BORNEE || typeVar == VARIABLE_BORNEE_SUPERIEUREMENT) + ? -pb.infinity() + : bMin; + double max_l = (typeVar == VARIABLE_NON_BORNEE || typeVar == VARIABLE_BORNEE_INFERIEUREMENT) + ? pb.infinity() + : bMax; + const bool isIntegerVariable = problemeSimplexe_->IntegerVariable(idxVar); + auto* var = pb.addVariable(min_l, max_l, isIntegerVariable, GetVariableName(idxVar)); pb.setObjectiveCoefficient(var, problemeSimplexe_->CoutLineaire[idxVar]); } From 9022814e71efd409cccf7fa12931e3bbbf948555 Mon Sep 17 00:00:00 2001 From: payetvin <113102157+payetvin@users.noreply.github.com> Date: Tue, 3 Dec 2024 10:03:24 +0100 Subject: [PATCH 3/6] Fix segfault when there are more districts than areas [ANT-2452] (#2516) --- src/solver/variable/surveyresults/surveyresults.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/solver/variable/surveyresults/surveyresults.cpp b/src/solver/variable/surveyresults/surveyresults.cpp index 6a89d2cb14..cb88d34003 100644 --- a/src/solver/variable/surveyresults/surveyresults.cpp +++ b/src/solver/variable/surveyresults/surveyresults.cpp @@ -553,16 +553,12 @@ SurveyResults::SurveyResults(const Data::Study& s, const Yuni::String& o, IResul } uint nbAreas = s.areas.size(); - uint nbSetsOfAreas = s.areas.size(); + uint nbSetsOfAreas = s.setsOfAreas.size(); digestSize = (nbAreas > nbSetsOfAreas) ? nbAreas : nbSetsOfAreas; digestNonApplicableStatus = new bool*[digestSize]; for (uint i = 0; i < digestSize; i++) { - digestNonApplicableStatus[i] = new bool[maxVariables]; - for (uint v = 0; v < maxVariables; v++) - { - digestNonApplicableStatus[i][v] = false; - } + digestNonApplicableStatus[i] = new bool[maxVariables]{false}; } } From 9355700f69a19ba8039eb31c71879b417c0c0c5f Mon Sep 17 00:00:00 2001 From: payetvin <113102157+payetvin@users.noreply.github.com> Date: Tue, 3 Dec 2024 14:55:27 +0100 Subject: [PATCH 4/6] 9.2 rc 6 (#2520) --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e1fca9a3d2..24ef38e558 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -8,7 +8,7 @@ set(ANTARES_VERSION_REVISION 0) # Beta release set(ANTARES_BETA 0) -set(ANTARES_RC 5) +set(ANTARES_RC 6) set(ANTARES_VERSION_YEAR 2024) From b7e529190463a18eb566b67972e66a73722c8222 Mon Sep 17 00:00:00 2001 From: payetvin <113102157+payetvin@users.noreply.github.com> Date: Tue, 3 Dec 2024 16:10:01 +0100 Subject: [PATCH 5/6] Bump simtest to 9.2f (#2521) --- simtest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simtest.json b/simtest.json index 03ea9af205..26875e3a2e 100644 --- a/simtest.json +++ b/simtest.json @@ -1,3 +1,3 @@ { - "version": "v9.2.0e" + "version": "v9.2.0f" } From 47ca3b01a1bca8d167d991a94a5728548236ea96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Omn=C3=A8s?= Date: Tue, 3 Dec 2024 16:20:12 +0100 Subject: [PATCH 6/6] Update doc for command invokation : --ortools-solver -> --solver (#2507) Following #2450 --------- Co-authored-by: Vincent Payet --- docs/developer-guide/ortools-integration.md | 6 +++--- docs/user-guide/04-migration-guides.md | 7 +++++++ docs/user-guide/solver/02-command-line.md | 2 +- docs/user-guide/solver/optional-features/xpress.md | 2 +- src/solver/misc/options.cpp | 2 +- src/tests/examples/conftest.py | 10 ++-------- src/tests/examples/specific_test.py | 6 ++---- src/tools/batchrun/main.cpp | 2 +- 8 files changed, 18 insertions(+), 19 deletions(-) diff --git a/docs/developer-guide/ortools-integration.md b/docs/developer-guide/ortools-integration.md index 4c0b4b8d8d..c953e04d57 100644 --- a/docs/developer-guide/ortools-integration.md +++ b/docs/developer-guide/ortools-integration.md @@ -52,10 +52,10 @@ These are the solver names and enum, defined in the [OR-Tools API](https://githu * A mixed real integer solver While the OR-Tools interface allows using multiple solvers, Antares restricts this usage. -The *Antares Simulator* user can select the solvers using the `ortools-solver` command-line option. Here are the allowed +The *Antares Simulator* user can select the solvers using the `solver` command-line option. Here are the allowed values: -| `ortools-solver` | Linear solver | Mixed real integer solver | +| `solver` | Linear solver | Mixed real integer solver | |:-------------------|--------------------------------|----------------------------------| | `sirius` (default) | SIRIUS_LINEAR_PROGRAMMING | SIRIUS_MIXED_INTEGER_PROGRAMMING | | `coin` | CLP_LINEAR_PROGRAMMING | CBC_MIXED_INTEGER_PROGRAMMING | @@ -65,7 +65,7 @@ values: The following commercial solvers are not yet supported by *Antares Simulator*, because of unmet pre-requisites: -| `ortools-solver` | Linear solver | Mixed real integer | Waiting for | +| `solver` | Linear solver | Mixed real integer | Waiting for | |:-----------------|---------------------------|----------------------------------|-----------------------------------------------------| | `cplex` | CPLEX_LINEAR_PROGRAMMING | CPLEX_MIXED_INTEGER_PROGRAMMING | Update OR-Tools building process for CPLEX support | | `gurobi` | GUROBI_LINEAR_PROGRAMMING | GUROBI_MIXED_INTEGER_PROGRAMMING | Update OR-Tools building process for GUROBI support | diff --git a/docs/user-guide/04-migration-guides.md b/docs/user-guide/04-migration-guides.md index 23f10a2668..1088f3766a 100644 --- a/docs/user-guide/04-migration-guides.md +++ b/docs/user-guide/04-migration-guides.md @@ -183,6 +183,13 @@ Using this property requires OR-Tools and a MILP solver (XPRESS, COIN) antares-8.8-solver --use-ortools --ortools-solver coin|xpress ... ``` +Starting from version 9.2, the syntax is as following + +``` +antares-solver --solver coin|xpress ... +``` + + ### Output ### Cashflow by short-term storage diff --git a/docs/user-guide/solver/02-command-line.md b/docs/user-guide/solver/02-command-line.md index 7cc927a662..88defa9062 100644 --- a/docs/user-guide/solver/02-command-line.md +++ b/docs/user-guide/solver/02-command-line.md @@ -17,7 +17,7 @@ hide: | --adequacy | Force the simulation in [adequacy](static-modeler/04-parameters.md#mode) mode | | --parallel | Enable [parallel](optional-features/multi-threading.md) computation of MC years | | --force-parallel=VALUE | Override the max number of years computed [simultaneously](optional-features/multi-threading.md) | -| --ortools-solver=VALUE | The optimization solver to use. Possible values are: `sirius` (default), `coin`, `xpress`, `scip` | +| --solver=VALUE | The optimization solver to use. Possible values are: `sirius` (default), `coin`, `xpress`, `scip` | ## Parameters diff --git a/docs/user-guide/solver/optional-features/xpress.md b/docs/user-guide/solver/optional-features/xpress.md index e8e5242f73..dfa1a07438 100644 --- a/docs/user-guide/solver/optional-features/xpress.md +++ b/docs/user-guide/solver/optional-features/xpress.md @@ -10,7 +10,7 @@ Antares Solver only uses LP, with plans to use MILP at some point in the future. ## Using Xpress in the command-line ``` -antares-solver --ortools-solver xpress [options] +antares-solver --solver xpress [options] ``` ## Setup diff --git a/src/solver/misc/options.cpp b/src/solver/misc/options.cpp index 6470023aff..d72bd4c692 100644 --- a/src/solver/misc/options.cpp +++ b/src/solver/misc/options.cpp @@ -75,7 +75,7 @@ std::unique_ptr CreateParser(Settings& settings, StudyLoad "force-parallel", "Override the max number of years computed simultaneously"); - //--ortools-solver + //--solver parser->add(options.optOptions.ortoolsSolver, ' ', "solver", diff --git a/src/tests/examples/conftest.py b/src/tests/examples/conftest.py index 49bfbdbce4..89d6f8ca7b 100644 --- a/src/tests/examples/conftest.py +++ b/src/tests/examples/conftest.py @@ -1,19 +1,13 @@ import pytest def pytest_addoption(parser): - parser.addoption("--use-ortools", action="store_true", default=False) - parser.addoption("--ortools-solver", action="store", default="sirius") + parser.addoption("--solver", action="store", default="sirius") parser.addoption("--solver-path", action="store") @pytest.fixture() def ortools_solver(request): - return request.config.getoption("--ortools-solver") + return request.config.getoption("--solver") -@pytest.fixture() -def use_ortools(request): - return request.config.getoption("--use-ortools") - @pytest.fixture() def solver_path(request): return request.config.getoption("--solver-path") - diff --git a/src/tests/examples/specific_test.py b/src/tests/examples/specific_test.py index 6372f5892a..bf4d997381 100644 --- a/src/tests/examples/specific_test.py +++ b/src/tests/examples/specific_test.py @@ -72,16 +72,14 @@ def remove_outputs(study_path): shutil.rmtree(f) -def launch_solver(solver_path, study_path, use_ortools=False, ortools_solver="sirius"): +def launch_solver(solver_path, study_path, ortools_solver="sirius"): # Clean study output remove_outputs(study_path) solver_path_full = str(Path(solver_path).resolve()) command = [solver_path_full, "-i", str(study_path)] - if use_ortools: - command.append('--use-ortools') - command.append('--ortools-solver=' + ortools_solver) + command.append('--solver=' + ortools_solver) process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=None) output = process.communicate() diff --git a/src/tools/batchrun/main.cpp b/src/tools/batchrun/main.cpp index 420dc060dd..4da485effd 100644 --- a/src/tools/batchrun/main.cpp +++ b/src/tools/batchrun/main.cpp @@ -175,7 +175,7 @@ int main(int argc, const char* argv[]) { // Wrap spaces around quotes, if any // example - // antares-batchrun directory --use-ortools --ortools-solver xpress + // antares-batchrun directory --solver xpress // --solver-parameters "PRESOLVE 1" cmd << " \"" << arg << "\""; }