Skip to content

Commit

Permalink
Merge pull request #15 from AntaresSimulatorTeam/feature/delta_cluste…
Browse files Browse the repository at this point in the history
…rs_scalian

Feature/delta clusters scalian
  • Loading branch information
meslubi2021 authored Dec 22, 2024
2 parents 63fa985 + cd9541e commit c97cc95
Show file tree
Hide file tree
Showing 9 changed files with 683 additions and 7 deletions.
6 changes: 6 additions & 0 deletions src/libs/antares/study/include/antares/study/parameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,12 @@ class Parameters final
bool storeTimeseriesNumbers;
//@}

//! \name Delta Cluster
//@{
//! Output the delta of groups inside clusters for each hour of each mode
bool exportRawOptimizationResults;
//@}

/*!
** \brief Read-only mode
**
Expand Down
1 change: 1 addition & 0 deletions src/libs/antares/study/load.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ void Study::parameterFiller(const StudyLoadOptions& options)
parameters.timeSeriesToArchive = 0;
parameters.storeTimeseriesNumbers = false;
parameters.synthesis = false;
parameters.exportRawOptimizationResults = false;
}

if (options.loadOnlyNeeded && !parameters.timeSeriesToGenerate)
Expand Down
6 changes: 6 additions & 0 deletions src/libs/antares/study/parameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,8 @@ void Parameters::reset()
// readonly
readonly = false;
synthesis = true;
// Outputing the delta of the number of groups that are on inside each clusters
exportRawOptimizationResults = false;

// Hydro heuristic policy
hydroHeuristicPolicy.hhPolicy = hhpAccommodateRuleCurves;
Expand Down Expand Up @@ -656,6 +658,10 @@ static bool SGDIntLoadFamily_Output(Parameters& d,
{
return value.to<bool>(d.synthesis);
}
if (key == "export-raw-optimization-results")
{
return value.to<bool>(d.exportRawOptimizationResults);
}
if (key == "hydro-debug")
{
return value.to<bool>(d.hydroDebug);
Expand Down
1 change: 1 addition & 0 deletions src/solver/optimisation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ set(RTESOLVER_OPT
opt_appel_solveur_quadratique.cpp
opt_gestion_second_membre_cas_lineaire.cpp
opt_optimisation_lineaire.cpp
opt_export_raw_optimization_results.cpp
opt_chainage_intercos.cpp
include/antares/solver/optimisation/opt_fonctions.h
include/antares/solver/optimisation/SparseVector.hxx
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,5 @@ void OPT_DecompteDesVariablesEtDesContraintesCoutsDeDemarrage(PROBLEME_HEBDO*);
void OPT_InitialiserNombreMinEtMaxDeGroupesCoutsDeDemarrage(PROBLEME_HEBDO*);
void OPT_AjusterLeNombreMinDeGroupesDemarresCoutsDeDemarrage(PROBLEME_HEBDO*);
double OPT_SommeDesPminThermiques(const PROBLEME_HEBDO*, int, uint);

void OPT_ExportRawOptimizationResults(PROBLEME_HEBDO*, Solver::IResultWriter&, std::string);
#endif /* __SOLVER_OPTIMISATION_FUNCTIONS_H__ */
657 changes: 657 additions & 0 deletions src/solver/optimisation/opt_export_raw_optimization_results.cpp

Large diffs are not rendered by default.

15 changes: 9 additions & 6 deletions src/solver/optimisation/opt_optimisation_lineaire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,19 +224,22 @@ bool OPT_OptimisationLineaire(const OptimizationOptions& options,
writer,
PREMIERE_OPTIMISATION,
simulationObserver);

std::string filename = "beforeHeuristic";
OPT_ExportRawOptimizationResults(problemeHebdo, writer, filename);
// We only need the 2nd optimization when NOT solving with integer variables
// We also skip the 2nd optimization in the hidden 'Expansion' mode
// and if the 1st one failed.
if (ret && !problemeHebdo->Expansion && !problemeHebdo->OptimisationAvecVariablesEntieres)
{
// We need to adjust some stuff before running the 2nd optimisation
runThermalHeuristic(problemeHebdo);
return runWeeklyOptimization(options,
problemeHebdo,
writer,
DEUXIEME_OPTIMISATION,
simulationObserver);
ret = runWeeklyOptimization(options,
problemeHebdo,
writer,
DEUXIEME_OPTIMISATION,
simulationObserver);
filename = "afterHeuristic";
OPT_ExportRawOptimizationResults(problemeHebdo, writer, filename);
}
return ret;
}
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,7 @@ struct PROBLEME_HEBDO
bool exportMPSOnError = false;
bool ExportStructure = false;
bool NamedProblems = false;
bool exportRawOptimizationResults = false;

uint32_t HeureDansLAnnee = 0;
bool LeProblemeADejaEteInstancie = false;
Expand Down
1 change: 1 addition & 0 deletions src/solver/simulation/sim_calcul_economique.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -983,4 +983,5 @@ void SIM_RenseignementProblemeHebdo(const Study& study,
problem.CaracteristiquesHydrauliques[k].ContrainteDePmaxHydrauliqueHoraireRef
= problem.CaracteristiquesHydrauliques[k].ContrainteDePmaxHydrauliqueHoraire;
}
problem.exportRawOptimizationResults = parameters.exportRawOptimizationResults;
}

0 comments on commit c97cc95

Please sign in to comment.