Skip to content

Commit

Permalink
Update doc for command invokation : --ortools-solver -> --solver (#2507)
Browse files Browse the repository at this point in the history
Following #2450

---------

Co-authored-by: Vincent Payet <vincent.payet@rte-france.com>
  • Loading branch information
flomnes and payetvin authored Dec 3, 2024
1 parent b7e5291 commit 47ca3b0
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 19 deletions.
6 changes: 3 additions & 3 deletions docs/developer-guide/ortools-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand All @@ -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 |
7 changes: 7 additions & 0 deletions docs/user-guide/04-migration-guides.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/user-guide/solver/02-command-line.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion docs/user-guide/solver/optional-features/xpress.md
Original file line number Diff line number Diff line change
Expand Up @@ -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] <study>
antares-solver --solver xpress [options] <study>
```

## Setup
Expand Down
2 changes: 1 addition & 1 deletion src/solver/misc/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ std::unique_ptr<Yuni::GetOpt::Parser> CreateParser(Settings& settings, StudyLoad
"force-parallel",
"Override the max number of years computed simultaneously");

//--ortools-solver
//--solver
parser->add(options.optOptions.ortoolsSolver,
' ',
"solver",
Expand Down
10 changes: 2 additions & 8 deletions src/tests/examples/conftest.py
Original file line number Diff line number Diff line change
@@ -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")

6 changes: 2 additions & 4 deletions src/tests/examples/specific_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion src/tools/batchrun/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 << "\"";
}
Expand Down

0 comments on commit 47ca3b0

Please sign in to comment.