From 802ddb91900527ee60a95aaca070990b1849b6ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Omn=C3=A8s?= <26088210+flomnes@users.noreply.github.com> Date: Fri, 22 Mar 2024 11:39:24 +0100 Subject: [PATCH] Make computation of intermediate values more readable (#2005) --- .../optimisation/opt_restaurer_les_donnees.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/solver/optimisation/opt_restaurer_les_donnees.cpp b/src/solver/optimisation/opt_restaurer_les_donnees.cpp index 4316298a01..88dc9532d4 100644 --- a/src/solver/optimisation/opt_restaurer_les_donnees.cpp +++ b/src/solver/optimisation/opt_restaurer_les_donnees.cpp @@ -57,7 +57,8 @@ void OPT_RestaurerLesDonnees(PROBLEME_HEBDO* problemeHebdo) if (!CaracteristiquesHydrauliques.PresenceDHydrauliqueModulable) continue; - CaracteristiquesHydrauliques.ContrainteDePmaxHydrauliqueHoraire[pdt] + double& hourlyPmax = CaracteristiquesHydrauliques.ContrainteDePmaxHydrauliqueHoraire[pdt]; + hourlyPmax = CaracteristiquesHydrauliques.ContrainteDePmaxHydrauliqueHoraireRef[pdt]; if (CaracteristiquesHydrauliques.SansHeuristique) continue; @@ -73,18 +74,11 @@ void OPT_RestaurerLesDonnees(PROBLEME_HEBDO* problemeHebdo) double PmaxHydUplift = CaracteristiquesHydrauliques.ContrainteDePmaxPompageHoraire[pdt]; PmaxHydUplift *= problemeHebdo->CoefficientEcretementPMaxHydraulique[pays]; - - if (PmaxHydEcretee < PmaxHydUplift) - PmaxHydEcretee = PmaxHydUplift; + PmaxHydEcretee = std::max(PmaxHydUplift, PmaxHydEcretee); } // The generating power allowance cannot exceed the maximum available generating power - if (PmaxHydEcretee - < CaracteristiquesHydrauliques.ContrainteDePmaxHydrauliqueHoraire[pdt]) - { - CaracteristiquesHydrauliques.ContrainteDePmaxHydrauliqueHoraire[pdt] - = PmaxHydEcretee; - } + hourlyPmax = std::min(PmaxHydEcretee, hourlyPmax); } }