Skip to content

Commit

Permalink
Merge branch 'develop' into fix/centos-build
Browse files Browse the repository at this point in the history
  • Loading branch information
payetvin authored Dec 4, 2024
2 parents 6fe4d1e + 47ca3b0 commit 9ce5b77
Show file tree
Hide file tree
Showing 20 changed files with 73 additions and 69 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 simtest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "v9.2.0e"
"version": "v9.2.0f"
}
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

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
15 changes: 12 additions & 3 deletions src/solver/optimisation/LegacyFiller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,32 +27,32 @@ 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<DispatchableMarginPostProcessCmd>(problemeHebdo_, thread_number_, areas));
std::make_unique<DispatchableMarginPostProcessCmd>(problemeHebdo_, numSpace_, areas));

post_process_list.push_back(
std::make_unique<HydroLevelsUpdatePostProcessCmd>(problemeHebdo_, areas, false, false));
post_process_list.push_back(std::make_unique<RemixHydroPostProcessCmd>(problemeHebdo_,
areas,
sheddingPolicy,
splxOptimization,
thread_number));
numSpace));

// Here a post process particular to adq patch
post_process_list.push_back(std::make_unique<CurtailmentSharingPostProcessCmd>(adqPatchParams,
problemeHebdo_,
areas,
thread_number_));
numSpace_));
// Here a post process particular to adq patch
post_process_list.push_back(
std::make_unique<DTGmarginForAdqPatchPostProcessCmd>(problemeHebdo_, areas, thread_number));
std::make_unique<DTGmarginForAdqPatchPostProcessCmd>(problemeHebdo_, areas, numSpace));
post_process_list.push_back(
std::make_unique<HydroLevelsUpdatePostProcessCmd>(problemeHebdo_, areas, true, false));
post_process_list.push_back(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class OptPostProcessList: public interfacePostProcessList
{
public:
OptPostProcessList(PROBLEME_HEBDO* problemeHebdo,
uint thread_number,
uint numSpace,
AreaList& areas,
SheddingPolicy sheddingPolicy,
SimplexOptimization splxOptimization,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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_;
};

Expand All @@ -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_;
};
Expand All @@ -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
Expand Down Expand Up @@ -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;

Expand All @@ -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
8 changes: 4 additions & 4 deletions src/solver/optimisation/optim_post_process_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<DispatchableMarginPostProcessCmd>(problemeHebdo_, thread_number_, areas));
std::make_unique<DispatchableMarginPostProcessCmd>(problemeHebdo_, numSpace_, areas));
post_process_list.push_back(
std::make_unique<HydroLevelsUpdatePostProcessCmd>(problemeHebdo_, areas, false, false));
post_process_list.push_back(std::make_unique<RemixHydroPostProcessCmd>(problemeHebdo_,
areas,
sheddingPolicy,
splxOptimization,
thread_number));
numSpace));
post_process_list.push_back(
std::make_unique<HydroLevelsUpdatePostProcessCmd>(problemeHebdo_, areas, true, false));
post_process_list.push_back(
Expand Down
24 changes: 12 additions & 12 deletions src/solver/optimisation/post_process_commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
}
Expand All @@ -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.;
Expand Down Expand Up @@ -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)
{
Expand All @@ -112,7 +112,7 @@ void RemixHydroPostProcessCmd::execute(const optRuntimeData& opt_runtime_data)
*problemeHebdo_,
shedding_policy_,
splx_optimization_,
thread_number_,
numSpace_,
hourInYear);
}

Expand All @@ -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)
{
}

Expand All @@ -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
Expand Down Expand Up @@ -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)
{
}

Expand Down Expand Up @@ -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(
Expand Down
8 changes: 4 additions & 4 deletions src/solver/simulation/base_post_process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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> interfacePostProcessList::create(
AdqPatchParams& adqPatchParams,
PROBLEME_HEBDO* problemeHebdo,
uint thread_number,
uint numSpace,
AreaList& areas,
SheddingPolicy sheddingPolicy,
SimplexOptimization splxOptimization,
Expand All @@ -53,7 +53,7 @@ std::unique_ptr<interfacePostProcessList> interfacePostProcessList::create(
{
return std::make_unique<AdqPatchPostProcessList>(adqPatchParams,
problemeHebdo,
thread_number,
numSpace,
areas,
sheddingPolicy,
splxOptimization,
Expand All @@ -62,7 +62,7 @@ std::unique_ptr<interfacePostProcessList> interfacePostProcessList::create(
else
{
return std::make_unique<OptPostProcessList>(problemeHebdo,
thread_number,
numSpace,
areas,
sheddingPolicy,
splxOptimization,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class interfacePostProcessList
// gp : the constructors' signatures of the post process list classes.
static std::unique_ptr<interfacePostProcessList> create(AdqPatchParams& adqPatchParams,
PROBLEME_HEBDO* problemeHebdo,
uint thread_number,
uint numSpace,
AreaList& areas,
SheddingPolicy sheddingPolicy,
SimplexOptimization splxOptimization,
Expand All @@ -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<std::unique_ptr<basePostProcessCommand>> post_process_list;
};

Expand Down
Loading

0 comments on commit 9ce5b77

Please sign in to comment.