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] 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 << "\""; }