Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adequacy patch vincent final #1087

Merged
merged 10 commits into from
Jan 17, 2023

Conversation

payetvin
Copy link
Contributor

No description provided.

@payetvin payetvin requested a review from flomnes January 13, 2023 14:29
@payetvin payetvin self-assigned this Jan 13, 2023
@flomnes
Copy link
Member

flomnes commented Jan 16, 2023

File adequacy_patch.cpp has been removed by #971. It has been replaced by adq_patch_curtailment_sharing.cpp
and adq_patch_local_matching.cpp. Can you please resolve that ?

Comment on lines +276 to 294
void Parameters::AdequacyPatch::LocalMatching::reset()
{
adqPatch.localMatching.setToZeroOutsideInsideLinks = true;
adqPatch.localMatching.setToZeroOutsideOutsideLinks = true;
setToZeroOutsideInsideLinks = true;
setToZeroOutsideOutsideLinks = true;
}

void Parameters::resetAdqPatch_CurtailmentSharing()
void Parameters::AdequacyPatch::CurtailmentSharing::reset()
{
adqPatch.curtailmentSharing.priceTakingOrder = Data::AdequacyPatch::AdqPatchPTO::isDens;
adqPatch.curtailmentSharing.includeHurdleCost = false;
adqPatch.curtailmentSharing.checkCsrCostFunction = false;
priceTakingOrder = Data::AdequacyPatch::AdqPatchPTO::isDens;
includeHurdleCost = false;
checkCsrCostFunction = false;
}

void Parameters::resetAdqPatchParameters()
{
adqPatch.enabled = false;
resetAdqPatch_LocalMatching();
resetAdqPatch_CurtailmentSharing();
adqPatch.localMatching.reset();
adqPatch.curtailmentSharing.reset();
resetThresholdsAdqPatch();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks SO much better

@flomnes flomnes added this to the v8.5 milestone Jan 17, 2023
@flomnes flomnes merged commit 3664b76 into feature/adq-patch-final Jan 17, 2023
@flomnes flomnes deleted the fix/adq-patch-vincent-final branch January 17, 2023 11:09
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 4 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

flomnes added a commit that referenced this pull request Jan 30, 2023
* 7. re-pack CSR run into weeklyOptProblem->solve method

* adopt RTE syntax for switch/case

* remove comments

* change RC number

* change beta release number

* unit test for CSR-calculateAreaFlowBalance

* small refacto

* unit test bug fix

* 4. remove unused

* 6.1 MemAllocMemset

* 5. remove return

* 3. remove debug log

* 2. move to csr

* 1. refacto

* 6.2 hide column

* 6.2

* 3. move log

* 3. move log..

* clean

* small fix year count

* hot start

* relax var bounds

* remove ENS <= densNew constraint, set as var bound

* remove set values to NaN if csr solver fails

* relax bining constrains for csr solver

* make csr crash log more expressive

* clean some logs

* beta 3 -> beta 4

* wrong relaxation of bc - bug fix

* logg out triggered csr hours

* refacto 1e-3

* logg out csr warnings - refacto

* update antares output dens value

* more expressive log

* update dens and use it as pto

* dont include linear cost coeff - temporary beta6 only

* beta5->beta6

* 10. bring back type of var to origin quad solver - mistake

* 2. remove default values for the solver accuracy

* change function  name to ADQ_PATCH_CSR

* 6. remove comments

* 7. remove nused transport cost

* 9. remove comments

* 11. refacto - int NumberOfVariables

* 8. remove NomDeLaContrainte

* bring back linear hurdle costs

* set to zero ENS & spillage if below threshold (avoid LOLP=100% dummy values)

* small refacto

* 4. make subfunction CSR_DEBUG_BLAH

* 1. move csr problem functions to separate directory

* 12. Add "Include hurdle cost" false/true button

* refacto avoid bugs

* refacto avoid bugs

* refacto bugs

* Fix build

Rename LinkCapacityForAdequacyPatchFirstStep -> ntcSetToZeroStatus_AdqPatchStep1

* 1. Make NumberOfVariables a reference var

* change function name CSR_DEBUG_

* 3. test Probleme.ExistenceDUneSolution directly

* 2. Slightly clearer version

* 4. make hoursRequiringCurtailmentSharing const var

* 5. avoid cast sumENS[i] to int!

* 17. move default thresholds to adequacy_patch.h

* 20. use A.size() in addArray function

* 19. create dedicated method solveCSR

* 7. name change

* 8. make methods of AdequacyPatchOptimization private

* 11. 14. 16 delete unused logs

* 9.  delete forward declaration of HOURLY_CSR_PROBLEM

* 15. remove Double definition.

* 12. 13 update copyright & Authors for adq-patch files

* make solveCSR private method

* use auto instead of std::unique_ptr<PROBLEME_POINT_INTERIEUR>

* float->double

* remove saveIntermediateResults

* code smells parameters.cpp

* critical-CodeSmell-adequacy_patch.cpp

* critical-codeSmells- set_problem_cost.cpp

* info-CodeSmell - remove todo-s

* CodeSmells - global var should be const

* NULL->nullptr

* use default destructor

* protected->private in adq-patch-area-grid.h

* use default constructor in adequacy-patch-areas

* Add the "explicit" keyword to AdequacyPatchAreas constructor

* NULL->nullptr in adequacy-patch-options.cpp

* = default, AdequacyPatchOptions

* Add the "explicit" keyword to AdequacyPatchOptions constructor

* Remove these useless parentheses

* Remove these useless parentheses

* Remove the unused parameter "weekNb",

* Move these 4 #include directives to the top of the file

* declaration shadows a local variable

* Value stored to 'ProblemeAResoudre' is never read

* function should be declared "const"

* Use "std::make_unique" to construct "std::unique_ptr

* Value stored to 'out' during its initialization is never read

* major-CodeSmells-adequacy-patch-options.cpp

* remove "never read" variables

* const& buttonType in updateButton

* Replace this "enum" with "enum class"  AdqPatchPTO

* double*->const double* in addArray

* MinorCodeSmell-s construct_LHS

* MinorCodeSmell-s construct_RHS

* MinorCodeSmell-s construct_variables

* MinorCodeSmell-s cost_function

* MinorCodeSmell-s set_var_bounds

* MinorCodeSmell-s solve_problem

* MinorCodeSmell-s economy.cpp

* Remove redundant public  access specifier

* Remove this redundant access specifier

* MinorCodeSmell-s adq-patch-unit-tests

* Concatenate  namespace with the nested ones.

* Use "override" or "final" instead of "virtual".

* Remove public redundant access specifier;

* MinorCodeSmell-s adequacy-patch-areas.h

* Concatenate namespace with the nested ones.

* Make the type of auto& study ; a reference-to-const

* MinorCodeSmell-s AdequacyPatchOptions

* "not"-> "!" , "and"-> "&&"

* Add adequacy-patch CSR study format changes (#817)

* beta 7

* create GUI for csr var relax button

* connect GUI to logic

* threshold e-3 >e-5

* fix (GUI wont pass smaller than 10^-6)

* Value stored to 'PaliersThermiquesDuPays' is never read

* "std::string" -> "std::string_view"

* make getHoursRequiringCurtailmentSharing const method

* remove unused var

* assign ProblemeAResoudre properly

* Reporting of DENS_new in GUI result for all hours

* Check CSR cost-fun-value prior&after CSR-opt - GUI

* refacto due to pre-calculating dens_new for all hours prior to csr optim

* add "SpilledenergyAfterCSR" column

* TODO: densNewValues

* Correction of MRG.PRICE Price Cap in hours LOLE>0.5 after CSR

* refacto "DENS_new" parameter calc, same thing at the end!?

* add DTG. MRG INT/FIN columns to GUI

* copy-paste spilled Energy values into spilled Energy values after CSR prior to CSR

* Check CSR cost value prior to and after - UNTESTED

* refacto on DTG MRG CSR columns GUI

* change log to info in "Check CSR cost value"

* test implementation csr fun cost prior/after

* refacto LMR violations according to the agreement with Daniel + clean

* csr-postProcess - adjust ENS value and calc dtgMrgCsr

* small refacto

* refacto - adjust mrgPrice after caclulating dtgMrgCsr and new Ens

* log update

* refacto setToZeroIfBelowThreshold

* update/refacto log csr-solver

* refacto logs @ solve_problem.cpp

* typo

* beta7 -> beta8

* add prefix [adq-patch] to info logs

* move adqPatchPostProcess after HydroRemix

* refactor + change -  storeOrDisregardInteriorPointResults

* beta 9.1

* refactor solveCSR

* add "- dtgMrg" to densNew formula

* beta 10

* fix error

* update 13-file-format.md for adq-patch CSR

* update 14-adequacy-patch.md for adq-patch CSR

* change CSR objective function (Elia)

* change CSR objective function (Elia) - doc update

* beta11

* change CSR objective function (Elia) - doc update

* 14-adq-patch-doc-bug fix (unrecognized characters)

* 14-adq-patch-doc-bug fix (unrecognized characters)-2

* Fix build (linking KO b/c of missing functions)

* Fix build

* Apply clang-format

* [UI] Fix build

* Fix code smells reported as bugs

* Use BOOST_CHECK_EQUAL to check equality (#1056)

To display a more expressive error message in case of failure, for example

src/tests/src/solver/optimisation/adequacy_patch.cpp(481): error: in "calculateAreaFlowBalanceForOneTimeStep_outside_inside_IncludeOut_negativeFlow_initEnsEqualTo0": check densNew == 0.1 has failed [0 != 0.10000000000000001]

* Adequacy patch refactoring (#962)

* [FIX] Refactored var names

* [REFAC] Changed class and var names in economy.h/cpp

* [REFAC] More correction of PR 903

* Fix build after rebase

Co-authored-by: Florian OMNES <florian.omnes@rte-france.com>

* Refactor adq patch (part 2) (#964)

* [FIX] Refactored var names

* [REFAC] Changed class and var names in economy.h/cpp

* [REFAC] More correction of PR 903

* Fix build after rebase

* Refactor adq patch (by gp) : lowering the solvers dependence to "state"

* Refactor adq patch (by gp) : lowering the solvers dependence to "state" (part 2)

* Refactor adq patch (by gp) : remove solveCSR from classic optimization problem

* Restore function setBoundsAdqPatch

* Fix build

Co-authored-by: Vincent Payet <vincent.payet@rte-france.com>
Co-authored-by: Florian OMNES <florian.omnes@rte-france.com>

* Adequacy patch : refactor economy (weekly optimization) (#968)

* [FIX] Refactored var names

* [REFAC] Changed class and var names in economy.h/cpp

* [REFAC] More correction of PR 903

* Fix build after rebase

* Refactor adq patch (by gp) : lowering the solvers dependence to "state"

* Refactor adq patch (by gp) : lowering the solvers dependence to "state" (part 2)

* Refactor adq patch (by gp) : remove solveCSR from classic optimization problem

* Refactor adq patch (by gp) : correction after merge (to get compilation done)

* adq patch - refactor economy : renaming

* adq patch - refactor economy : define a weekyOptimization for each problemeHebdo

* solveCSR => implementation in separate file

* adq patch - refactor economy : correction to avoid conflict in the next merge

* adq patch - refactor economy : move declaration of class interfaceWeeklyOptimization in a new file

* adq patch - refactor economy : extract weekly optimization classes in separate source files

* adq patch - refactor economy : correction due to review

* adq patch - refactor economy : remove useless function arguments due to sonar review

* Fix build

* Restore function setBoundsAdqPatch

* Add virtual dtors

* Remove useless return statement

* Nested namespaces, formatting

* Make protected members const

Co-authored-by: Vincent Payet <vincent.payet@rte-france.com>
Co-authored-by: Florian OMNES <florian.omnes@rte-france.com>

* Adequacy patch :  refactor curtailment sharing (#971)

* Adequacy patch CSR - final (#958)

* change origin/extremityAreaType to AreaMode

* refacto function SetNTCForAdequacyFirstStep

* LinkCapacityForAdqPatchFirstStepFromAreaOutsideToAreaInsideAdq name change

* name change for LinkCapacityForAdequacyPatchFirstStep

* remove returnNTC form adq functions.

* remove unnecessary break

* make readAdqPatchMode function

* make ini file more expressive

* remove additional check for ini file

* refacto

* make version 8.3.0

* Revert "make version 8.3.0"

* fix

* fix

* synchronize names setToZeroNTCfrom..

* synchronize names pBtn...

* synchronize adequacy-patch-options.cpp

* synchronize names adqm..

* synchronize names AreaType to AreaMode

* synchronize names LinkCapacity..

* synchronize name physicalAreaInsideAdqPatch

* 1. do not modify Yuni library

* 3. AdequacyPatchPTO name change

* 3. update

* 2-8. replace seeds with two thresholds

* 9. resetAdqPatchParameters

* 10. re-name lmrViolations.h

* 25-26. re-name AdequacyPatchConfigure to AdequacyPatchOptions

* 27. cellValue change

* 28. is already implemented + small refacto

* small refacto

* 29. updateButton function

* 13. renaming

* 14. refactoring

* 15. remove redundancy

* 16. refactoring

* 20. separate LHS to functions

* 20. separate RHS to functions

* clean

* 23. separate Costs into functions

* 22. separate Bounds into functions

* 21. separate Construction of variables into functions

* 19. separate quad-solver into sub-functions

* 11. separate getHoursRequiringCurtailmentSharing into two sub-functions

* 17+18+24. make OPT_ functions private methods and make public run method

* clean

* clean

* clean

* 0 as a default value, and (value > threshold)

* 4. add else if for AdqPatchPTO::isDens

* bring back some debugg logs for easy result check

* 2. make calculateCsrParameters method of HOURLY_CSR_PROBLEM

* clean

* 1. use std::vector for sumENS

* 9. repack CSR ui input data in parameters.h

* 8. placing all functions inside adequacy_patch.h to namespace Adequcy patch

* 7. re-pack CSR run into weeklyOptProblem->solve method

* adopt RTE syntax for switch/case

* remove comments

* change RC number

* change beta release number

* unit test for CSR-calculateAreaFlowBalance

* small refacto

* unit test bug fix

* 4. remove unused

* 6.1 MemAllocMemset

* 5. remove return

* 3. remove debug log

* 2. move to csr

* 1. refacto

* 6.2 hide column

* 6.2

* 3. move log

* 3. move log..

* clean

* small fix year count

* hot start

* relax var bounds

* remove ENS <= densNew constraint, set as var bound

* remove set values to NaN if csr solver fails

* relax bining constrains for csr solver

* make csr crash log more expressive

* clean some logs

* beta 3 -> beta 4

* wrong relaxation of bc - bug fix

* logg out triggered csr hours

* refacto 1e-3

* logg out csr warnings - refacto

* update antares output dens value

* more expressive log

* update dens and use it as pto

* dont include linear cost coeff - temporary beta6 only

* beta5->beta6

* 10. bring back type of var to origin quad solver - mistake

* 2. remove default values for the solver accuracy

* change function  name to ADQ_PATCH_CSR

* 6. remove comments

* 7. remove nused transport cost

* 9. remove comments

* 11. refacto - int NumberOfVariables

* 8. remove NomDeLaContrainte

* bring back linear hurdle costs

* set to zero ENS & spillage if below threshold (avoid LOLP=100% dummy values)

* small refacto

* 4. make subfunction CSR_DEBUG_BLAH

* 1. move csr problem functions to separate directory

* 12. Add "Include hurdle cost" false/true button

* refacto avoid bugs

* refacto avoid bugs

* refacto bugs

* Fix build

Rename LinkCapacityForAdequacyPatchFirstStep -> ntcSetToZeroStatus_AdqPatchStep1

* 1. Make NumberOfVariables a reference var

* change function name CSR_DEBUG_

* 3. test Probleme.ExistenceDUneSolution directly

* 2. Slightly clearer version

* 4. make hoursRequiringCurtailmentSharing const var

* 5. avoid cast sumENS[i] to int!

* 17. move default thresholds to adequacy_patch.h

* 20. use A.size() in addArray function

* 19. create dedicated method solveCSR

* 7. name change

* 8. make methods of AdequacyPatchOptimization private

* 11. 14. 16 delete unused logs

* 9.  delete forward declaration of HOURLY_CSR_PROBLEM

* 15. remove Double definition.

* 12. 13 update copyright & Authors for adq-patch files

* make solveCSR private method

* use auto instead of std::unique_ptr<PROBLEME_POINT_INTERIEUR>

* float->double

* remove saveIntermediateResults

* code smells parameters.cpp

* critical-CodeSmell-adequacy_patch.cpp

* critical-codeSmells- set_problem_cost.cpp

* info-CodeSmell - remove todo-s

* CodeSmells - global var should be const

* NULL->nullptr

* use default destructor

* protected->private in adq-patch-area-grid.h

* use default constructor in adequacy-patch-areas

* Add the "explicit" keyword to AdequacyPatchAreas constructor

* NULL->nullptr in adequacy-patch-options.cpp

* = default, AdequacyPatchOptions

* Add the "explicit" keyword to AdequacyPatchOptions constructor

* Remove these useless parentheses

* Remove these useless parentheses

* Remove the unused parameter "weekNb",

* Move these 4 #include directives to the top of the file

* declaration shadows a local variable

* Value stored to 'ProblemeAResoudre' is never read

* function should be declared "const"

* Use "std::make_unique" to construct "std::unique_ptr

* Value stored to 'out' during its initialization is never read

* major-CodeSmells-adequacy-patch-options.cpp

* remove "never read" variables

* const& buttonType in updateButton

* Replace this "enum" with "enum class"  AdqPatchPTO

* double*->const double* in addArray

* MinorCodeSmell-s construct_LHS

* MinorCodeSmell-s construct_RHS

* MinorCodeSmell-s construct_variables

* MinorCodeSmell-s cost_function

* MinorCodeSmell-s set_var_bounds

* MinorCodeSmell-s solve_problem

* MinorCodeSmell-s economy.cpp

* Remove redundant public  access specifier

* Remove this redundant access specifier

* MinorCodeSmell-s adq-patch-unit-tests

* Concatenate  namespace with the nested ones.

* Use "override" or "final" instead of "virtual".

* Remove public redundant access specifier;

* MinorCodeSmell-s adequacy-patch-areas.h

* Concatenate namespace with the nested ones.

* Make the type of auto& study ; a reference-to-const

* MinorCodeSmell-s AdequacyPatchOptions

* "not"-> "!" , "and"-> "&&"

* beta 7

* create GUI for csr var relax button

* connect GUI to logic

* threshold e-3 >e-5

* fix (GUI wont pass smaller than 10^-6)

* Value stored to 'PaliersThermiquesDuPays' is never read

* "std::string" -> "std::string_view"

* make getHoursRequiringCurtailmentSharing const method

* remove unused var

* assign ProblemeAResoudre properly

* Reporting of DENS_new in GUI result for all hours

* Check CSR cost-fun-value prior&after CSR-opt - GUI

* refacto due to pre-calculating dens_new for all hours prior to csr optim

* add "SpilledenergyAfterCSR" column

* TODO: densNewValues

* Correction of MRG.PRICE Price Cap in hours LOLE>0.5 after CSR

* refacto "DENS_new" parameter calc, same thing at the end!?

* add DTG. MRG INT/FIN columns to GUI

* copy-paste spilled Energy values into spilled Energy values after CSR prior to CSR

* Check CSR cost value prior to and after - UNTESTED

* refacto on DTG MRG CSR columns GUI

* change log to info in "Check CSR cost value"

* test implementation csr fun cost prior/after

* refacto LMR violations according to the agreement with Daniel + clean

* csr-postProcess - adjust ENS value and calc dtgMrgCsr

* small refacto

* refacto - adjust mrgPrice after caclulating dtgMrgCsr and new Ens

* log update

* refacto setToZeroIfBelowThreshold

* update/refacto log csr-solver

* refacto logs @ solve_problem.cpp

* typo

* beta7 -> beta8

* add prefix [adq-patch] to info logs

* move adqPatchPostProcess after HydroRemix

* refactor + change -  storeOrDisregardInteriorPointResults

* beta 9.1

* refactor solveCSR

* add "- dtgMrg" to densNew formula

* beta 10

Co-authored-by: hugo-antoine-rtei <73881097+hugo-antoine-rtei@users.noreply.github.com>
Co-authored-by: rtei-pw <rtei-pw@rte-international.com>
Co-authored-by: rtei-pw <rtei-pw@github.com>
Co-authored-by: Florian OMNES <florian.omnes@rte-france.com>
Co-authored-by: Hugo ANTOINE (RTEi) <hugo.antoine@rte-international.com>

* [FIX] FIx compile error

* [FIX] Refactored var names

* [REFAC] Changed class and var names in economy.h/cpp

* [REFAC] More correction of PR 903

* Refactor adq patch (by gp) : lowering the solvers dependence to "state"

* Refactor adq patch (by gp) : lowering the solvers dependence to "state" (part 2)

* Refactor adq patch (by gp) : correction after merge (to get compilation done)

* adq patch - refactor economy : renaming

* Refactor adq patch (by gp) : remove solveCSR from classic optimization problem

* adq patch - refactor economy : define a weekyOptimization for each problemeHebdo

* adq patch - refactor economy : correction to avoid conflict in the next merge

* adq patch - refactor economy : move declaration of class interfaceWeeklyOptimization in a new file

* adq patch - refactor economy : extract weekly optimization classes in separate source files

* adq patch - refactor economy : correction due to review

* adq patch - refactor economy : remove useless function arguments due to sonar review

* adq patch - refactor csr : simplify and remove useless things

* adq patch - refactor csr : split adequacy_patch.h/.cpp into local matching and curtailment sharing sources files

* Clean up headers

Co-authored-by: Milos <97689304+Milos-RTEi@users.noreply.github.com>
Co-authored-by: hugo-antoine-rtei <73881097+hugo-antoine-rtei@users.noreply.github.com>
Co-authored-by: rtei-pw <rtei-pw@rte-international.com>
Co-authored-by: rtei-pw <rtei-pw@github.com>
Co-authored-by: Florian OMNES <florian.omnes@rte-france.com>
Co-authored-by: Hugo ANTOINE (RTEi) <hugo.antoine@rte-international.com>
Co-authored-by: Vincent Payet <vincent.payet@rte-france.com>

* Adequacy patch vincent final (#1087)

* [FIX] Namespace concatenation in src/solver/simulation/

* [DEV] Moved reset csr and lm in dedicated structs

* [DEV] Create class CsrQuadraticProblem and moved functions in

* [DEV] Refactored functions in CsrQuadraticProblem class

* [DEV] FIx reference

* Pass hourlyCsrProblem.hourInWeekTriggeredCsr, not hourlyCsrProblem

* Nested namespaces

* Fix build, use non-const ref in class `CsrQuadraticProblem`

* [DEV] Concatenate namespace before merge

Co-authored-by: Florian OMNES <florian.omnes@rte-france.com>

* Remove state from interpolateWaterValue

* [DEV] Concatenate namespace done (#1094)

* Check for incompatible hurdle cost options (#1096)

* [DEV] Add rte banner in files missing it (#1097)

* [FIX] Adequacy code smells (#1100)

* [FIX] First batch of code smell

* [FIX] More smell fixes

* [FIX] Fix nested if and fort

* [FIX] Remove using Antares::Data::AdequacyPatch and solved compiles errors related

* [FIX] More code smells

* [FIX] Compile errors

* [FIX] Clarify condition

* [CSR] Clarify implicit var convention (#1095)

* CSR : clarify implicit convention on variable numbers for links

* CSR: clarify debug logs

* Renaming after PR remarks

* Pass hour instead of hourlyCsrProblem (#1098)

* Pass hour instead of hourlyCsrProblem

* Pass int for hour instead of a struct containing it

* move calculation of LMR violations from CSR source file to adq patch weekly problem (#1102)

* Move var declaration to right scope (#1103)

* [FIX] Move var declaration to right scope

* Fix infinite loop, possible other bug (#1107)

* Preparatory refactor to use own instance of PROBLEME_A_RESOUDRE (#1099)

* Simplify UtiliserLaToleranceDAdmissibiliteParDefaut, etc.

* Use PROBLEME_POINT_INTERIEUR for calculateCsrCostFunctionValue

* Pass hour instead of HOURLY_CSR_PROBLEM&

* Use PROBLEME_POINT_INTERIEUR for CSR_DEBUG_HANDLE, handleInteriorPointError

* PR remarks (use ref on object, not unique_ptr)

* Rename HOURLY_CSR_PROBLEM -> HourlyCSRProblem

* Apply clang-format

* Move files

* Move csr_quadratic_problem.h,cpp

* Remove unused fwd declaration

* Don't instantiate HourlyCSRProblem for every hour, setHour instead

* Rename OPT_ConstruireLaMatriceDesContraintesDuProblemeQuadratique_CSR

* Use std::vector::data instead of malloc/free

* Some renaming

* Add forgotten '{'

* Use our own instance of `PROBLEME_ANTARES_A_RESOUDRE` (#1105)

* Simplify UtiliserLaToleranceDAdmissibiliteParDefaut, etc.

* Use PROBLEME_POINT_INTERIEUR for calculateCsrCostFunctionValue

* Pass hour instead of HOURLY_CSR_PROBLEM&

* Use PROBLEME_POINT_INTERIEUR for CSR_DEBUG_HANDLE, handleInteriorPointError

* PR remarks (use ref on object, not unique_ptr)

* Rename HOURLY_CSR_PROBLEM -> HourlyCSRProblem

* Apply clang-format

* Move files

* Move csr_quadratic_problem.h,cpp

* Remove unused fwd declaration

* Don't instantiate HourlyCSRProblem for every hour, setHour instead

* Rename OPT_ConstruireLaMatriceDesContraintesDuProblemeQuadratique_CSR

* Use std::vector::data instead of malloc/free

* Some renaming

* Use our own instance of PROBLEME_ANTARES_A_RESOUDRE

* Refactor 2 more functions

OPT_InitialiserLeSecondMembreDuProblemeQuadratique_CSR
OPT_ConstruireLaListeDesVariablesOptimiseesDuProblemeQuadratique_CSR

* Use reference instead of raw pointer

* Extract allocation function for PROBLEME_ANTARES_A_RESOUDRE

* Use std::fill_n instead of memset

* PR remark

* Extract OPT_FreeOptimizationData

* Handle memory allocation/deallocation

* UpperCamelCase for some classes, move sources to adequacy_patch_csr (#1108)

* [FIX] UpperCamelCase for some classes

* [FIX] Moved csr files in adequacy_patch_csr/

* [FIX] Swap DefaultWeeklyOptimization WeeklyOptimization names

* [FIX] Add Antares::Data::Optimization namespace

* Remove `OPT_*_CSR` functions (#1111)

* Remove OPT_*_CSR functions

* Rename hourInWeekTriggeredCsr -> triggeredHour

* Fix regression related to while loop and unitialized quadratic costs (#1112)

* Fix regression related to while loop

* Fix 2nd regression related to unitialized quadratic cost

* Fix build after merge

* Fix a few more code smells (#1113)

* Fix a few code smells

* Apply clang-format

* Remove unused function ResetButtonSpecify

* Code smells  (#1114)

* [FIX] Code smells

* Temporarily disable all release tests

* Use simtest v8.5.0b

* Refactor optimization post process (#1109)

* move calculation of LMR violations from CSR source file to adq patch weekly problem

* Refactor Optimization post processes : first work : add abstractions for post-process commands and for a list of them.

* Refactor Optimization post processes : move the first post process in the list of post processes to be run

* Refactor Optimization post processes : fixing a regression

* Refactor Optimization post processes : moving the code of the post process associated to dispatchable margin into the command class

* Refactor Optimization post processes : some cleaning (see details in the commit's body)

- Narrow arguments of optimization post process functions. For example, study is passes while we only need the study's collection of areas
- Not pass the constant "nbHoursInAWeek" as an argument, rather make it a constant visible by every function using it.
- Remove some useless headers

* Refactor Optimization post processes : fixing a crash

* Refactor Optimization post processes : adding hydro levels update to list of post process

* Refactor Optimization post processes : adding hydro remix to the list of post process

* Refactor Optimization post processes : adding DTG margin for adq patch to the list of post process

* Refactor Optimization post processes : forgot to remove adqPatchPostProcess function from curtailment sharing problem

* Refactor Optimization post processes : adding hydro levels update (after remix) to list of post process

* Refactor Optimization post processes : adding post process "interpolate water value" to list of post process

* Refactor Optimization post processes : adding post process "Hydro Levels Final Update" to list of post process

* [skip ci] Refactor Optimization post processes : adding an empty CSR command to list of post process (to be filled later)

* Refactor Optimization post processes : correction after code review

* [skip ci] Refactor Optimization post processes : make destructors virtual

* [FIX] Changed ProblemeHebdo to problemeHebdo (#1124)

* Fix linking issue in libmodel

* Move CSR from adq patch to post process cmd (#1118)

* move calculation of LMR violations from CSR source file to adq patch weekly problem

* Refactor Optimization post processes : first work : add abstractions for post-process commands and for a list of them.

* Refactor Optimization post processes : move the first post process in the list of post processes to be run

* Refactor Optimization post processes : fixing a regression

* Refactor Optimization post processes : moving the code of the post process associated to dispatchable margin into the command class

* Refactor Optimization post processes : some cleaning (see details in the commit's body)

- Narrow arguments of optimization post process functions. For example, study is passes while we only need the study's collection of areas
- Not pass the constant "nbHoursInAWeek" as an argument, rather make it a constant visible by every function using it.
- Remove some useless headers

* Refactor Optimization post processes : fixing a crash

* Refactor Optimization post processes : adding hydro levels update to list of post process

* Refactor Optimization post processes : adding hydro remix to the list of post process

* Refactor Optimization post processes : adding DTG margin for adq patch to the list of post process

* Refactor Optimization post processes : forgot to remove adqPatchPostProcess function from curtailment sharing problem

* Refactor Optimization post processes : adding hydro levels update (after remix) to list of post process

* Refactor Optimization post processes : adding post process "interpolate water value" to list of post process

* Refactor Optimization post processes : adding post process "Hydro Levels Final Update" to list of post process

* [skip ci] Refactor Optimization post processes : adding an empty CSR command to list of post process (to be filled later)

* Refactor Optimization post processes : correction after code review

* [skip ci] Refactor Optimization post processes : make destructors virtual

* Moving curtailment sharing from adequacy patch to a post process command

* [skip ci] Moving CSR to a post process command : cleaning

* Remove `struct`, clean up

* Apply clang-format

Co-authored-by: Florian OMNES <florian.omnes@rte-france.com>

* [FIX] Add local_matching subdir (#1125)

* Change Var to var (#1126)

* [FIX] Change Var to var in optimisation folder

* [FIX] Refactored old code

* Fix/move csr to post process cmd (#1128)

* move calculation of LMR violations from CSR source file to adq patch weekly problem

* Refactor Optimization post processes : first work : add abstractions for post-process commands and for a list of them.

* Refactor Optimization post processes : move the first post process in the list of post processes to be run

* Refactor Optimization post processes : fixing a regression

* Refactor Optimization post processes : moving the code of the post process associated to dispatchable margin into the command class

* Refactor Optimization post processes : some cleaning (see details in the commit's body)

- Narrow arguments of optimization post process functions. For example, study is passes while we only need the study's collection of areas
- Not pass the constant "nbHoursInAWeek" as an argument, rather make it a constant visible by every function using it.
- Remove some useless headers

* Refactor Optimization post processes : fixing a crash

* Refactor Optimization post processes : adding hydro levels update to list of post process

* Refactor Optimization post processes : adding hydro remix to the list of post process

* Refactor Optimization post processes : adding DTG margin for adq patch to the list of post process

* Refactor Optimization post processes : forgot to remove adqPatchPostProcess function from curtailment sharing problem

* Refactor Optimization post processes : adding hydro levels update (after remix) to list of post process

* Refactor Optimization post processes : adding post process "interpolate water value" to list of post process

* Refactor Optimization post processes : adding post process "Hydro Levels Final Update" to list of post process

* [skip ci] Refactor Optimization post processes : adding an empty CSR command to list of post process (to be filled later)

* Refactor Optimization post processes : correction after code review

* [skip ci] Refactor Optimization post processes : make destructors virtual

* Moving curtailment sharing from adequacy patch to a post process command

* [skip ci] Moving CSR to a post process command : cleaning

* Remove `struct`, clean up

* Apply clang-format

* Remove `struct`, clean up

---------

Co-authored-by: Guillaume PIERRE <guillaume.pierre@rte-france.com>

* Restore tests for releases

* Add adequacy-patch-CSR

* Re-order format change documentation

---------

Co-authored-by: Milos A <milos.andjelkovic@redstork-solutions.com>
Co-authored-by: Milos <97689304+Milos-RTEi@users.noreply.github.com>
Co-authored-by: rtei-pw <rtei-pw@github.com>
Co-authored-by: Hugo ANTOINE (RTEi) <hugo.antoine@rte-international.com>
Co-authored-by: hugo-antoine-rtei <73881097+hugo-antoine-rtei@users.noreply.github.com>
Co-authored-by: payetvin <113102157+payetvin@users.noreply.github.com>
Co-authored-by: guilpier-code <62292552+guilpier-code@users.noreply.github.com>
Co-authored-by: Vincent Payet <vincent.payet@rte-france.com>
Co-authored-by: rtei-pw <rtei-pw@rte-international.com>
Co-authored-by: Jason Marechal <jason.marechal+github@gmail.com>
Co-authored-by: Guillaume PIERRE <guillaume.pierre@rte-france.com>
flomnes added a commit that referenced this pull request Jan 30, 2023
* change RC number

* change beta release number

* unit test for CSR-calculateAreaFlowBalance

* small refacto

* unit test bug fix

* 4. remove unused

* 6.1 MemAllocMemset

* 5. remove return

* 3. remove debug log

* 2. move to csr

* 1. refacto

* 6.2 hide column

* 6.2

* 3. move log

* 3. move log..

* clean

* small fix year count

* hot start

* relax var bounds

* remove ENS <= densNew constraint, set as var bound

* remove set values to NaN if csr solver fails

* relax bining constrains for csr solver

* make csr crash log more expressive

* clean some logs

* beta 3 -> beta 4

* wrong relaxation of bc - bug fix

* logg out triggered csr hours

* refacto 1e-3

* logg out csr warnings - refacto

* update antares output dens value

* more expressive log

* update dens and use it as pto

* dont include linear cost coeff - temporary beta6 only

* beta5->beta6

* 10. bring back type of var to origin quad solver - mistake

* 2. remove default values for the solver accuracy

* change function  name to ADQ_PATCH_CSR

* 6. remove comments

* 7. remove nused transport cost

* 9. remove comments

* 11. refacto - int NumberOfVariables

* 8. remove NomDeLaContrainte

* bring back linear hurdle costs

* set to zero ENS & spillage if below threshold (avoid LOLP=100% dummy values)

* small refacto

* 4. make subfunction CSR_DEBUG_BLAH

* 1. move csr problem functions to separate directory

* 12. Add "Include hurdle cost" false/true button

* refacto avoid bugs

* refacto avoid bugs

* refacto bugs

* Fix build

Rename LinkCapacityForAdequacyPatchFirstStep -> ntcSetToZeroStatus_AdqPatchStep1

* 1. Make NumberOfVariables a reference var

* change function name CSR_DEBUG_

* 3. test Probleme.ExistenceDUneSolution directly

* 2. Slightly clearer version

* 4. make hoursRequiringCurtailmentSharing const var

* 5. avoid cast sumENS[i] to int!

* 17. move default thresholds to adequacy_patch.h

* 20. use A.size() in addArray function

* 19. create dedicated method solveCSR

* 7. name change

* 8. make methods of AdequacyPatchOptimization private

* 11. 14. 16 delete unused logs

* 9.  delete forward declaration of HOURLY_CSR_PROBLEM

* 15. remove Double definition.

* 12. 13 update copyright & Authors for adq-patch files

* make solveCSR private method

* use auto instead of std::unique_ptr<PROBLEME_POINT_INTERIEUR>

* float->double

* remove saveIntermediateResults

* code smells parameters.cpp

* critical-CodeSmell-adequacy_patch.cpp

* critical-codeSmells- set_problem_cost.cpp

* info-CodeSmell - remove todo-s

* CodeSmells - global var should be const

* NULL->nullptr

* use default destructor

* protected->private in adq-patch-area-grid.h

* use default constructor in adequacy-patch-areas

* Add the "explicit" keyword to AdequacyPatchAreas constructor

* NULL->nullptr in adequacy-patch-options.cpp

* = default, AdequacyPatchOptions

* Add the "explicit" keyword to AdequacyPatchOptions constructor

* Remove these useless parentheses

* Remove these useless parentheses

* Remove the unused parameter "weekNb",

* Move these 4 #include directives to the top of the file

* declaration shadows a local variable

* Value stored to 'ProblemeAResoudre' is never read

* function should be declared "const"

* Use "std::make_unique" to construct "std::unique_ptr

* Value stored to 'out' during its initialization is never read

* major-CodeSmells-adequacy-patch-options.cpp

* remove "never read" variables

* const& buttonType in updateButton

* Replace this "enum" with "enum class"  AdqPatchPTO

* double*->const double* in addArray

* MinorCodeSmell-s construct_LHS

* MinorCodeSmell-s construct_RHS

* MinorCodeSmell-s construct_variables

* MinorCodeSmell-s cost_function

* MinorCodeSmell-s set_var_bounds

* MinorCodeSmell-s solve_problem

* MinorCodeSmell-s economy.cpp

* Remove redundant public  access specifier

* Remove this redundant access specifier

* MinorCodeSmell-s adq-patch-unit-tests

* Concatenate  namespace with the nested ones.

* Use "override" or "final" instead of "virtual".

* Remove public redundant access specifier;

* MinorCodeSmell-s adequacy-patch-areas.h

* Concatenate namespace with the nested ones.

* Make the type of auto& study ; a reference-to-const

* MinorCodeSmell-s AdequacyPatchOptions

* "not"-> "!" , "and"-> "&&"

* Add adequacy-patch CSR study format changes (#817)

* beta 7

* create GUI for csr var relax button

* connect GUI to logic

* threshold e-3 >e-5

* fix (GUI wont pass smaller than 10^-6)

* Value stored to 'PaliersThermiquesDuPays' is never read

* "std::string" -> "std::string_view"

* make getHoursRequiringCurtailmentSharing const method

* remove unused var

* assign ProblemeAResoudre properly

* Reporting of DENS_new in GUI result for all hours

* Check CSR cost-fun-value prior&after CSR-opt - GUI

* refacto due to pre-calculating dens_new for all hours prior to csr optim

* add "SpilledenergyAfterCSR" column

* TODO: densNewValues

* Correction of MRG.PRICE Price Cap in hours LOLE>0.5 after CSR

* refacto "DENS_new" parameter calc, same thing at the end!?

* add DTG. MRG INT/FIN columns to GUI

* copy-paste spilled Energy values into spilled Energy values after CSR prior to CSR

* Check CSR cost value prior to and after - UNTESTED

* refacto on DTG MRG CSR columns GUI

* change log to info in "Check CSR cost value"

* test implementation csr fun cost prior/after

* refacto LMR violations according to the agreement with Daniel + clean

* csr-postProcess - adjust ENS value and calc dtgMrgCsr

* small refacto

* refacto - adjust mrgPrice after caclulating dtgMrgCsr and new Ens

* log update

* refacto setToZeroIfBelowThreshold

* update/refacto log csr-solver

* refacto logs @ solve_problem.cpp

* typo

* beta7 -> beta8

* add prefix [adq-patch] to info logs

* move adqPatchPostProcess after HydroRemix

* refactor + change -  storeOrDisregardInteriorPointResults

* beta 9.1

* refactor solveCSR

* add "- dtgMrg" to densNew formula

* beta 10

* fix error

* update 13-file-format.md for adq-patch CSR

* update 14-adequacy-patch.md for adq-patch CSR

* change CSR objective function (Elia)

* change CSR objective function (Elia) - doc update

* beta11

* change CSR objective function (Elia) - doc update

* 14-adq-patch-doc-bug fix (unrecognized characters)

* 14-adq-patch-doc-bug fix (unrecognized characters)-2

* Fix build (linking KO b/c of missing functions)

* Fix build

* Apply clang-format

* [UI] Fix build

* Fix code smells reported as bugs

* Use BOOST_CHECK_EQUAL to check equality (#1056)

To display a more expressive error message in case of failure, for example

src/tests/src/solver/optimisation/adequacy_patch.cpp(481): error: in "calculateAreaFlowBalanceForOneTimeStep_outside_inside_IncludeOut_negativeFlow_initEnsEqualTo0": check densNew == 0.1 has failed [0 != 0.10000000000000001]

* Adequacy patch refactoring (#962)

* [FIX] Refactored var names

* [REFAC] Changed class and var names in economy.h/cpp

* [REFAC] More correction of PR 903

* Fix build after rebase

Co-authored-by: Florian OMNES <florian.omnes@rte-france.com>

* Refactor adq patch (part 2) (#964)

* [FIX] Refactored var names

* [REFAC] Changed class and var names in economy.h/cpp

* [REFAC] More correction of PR 903

* Fix build after rebase

* Refactor adq patch (by gp) : lowering the solvers dependence to "state"

* Refactor adq patch (by gp) : lowering the solvers dependence to "state" (part 2)

* Refactor adq patch (by gp) : remove solveCSR from classic optimization problem

* Restore function setBoundsAdqPatch

* Fix build

Co-authored-by: Vincent Payet <vincent.payet@rte-france.com>
Co-authored-by: Florian OMNES <florian.omnes@rte-france.com>

* Adequacy patch : refactor economy (weekly optimization) (#968)

* [FIX] Refactored var names

* [REFAC] Changed class and var names in economy.h/cpp

* [REFAC] More correction of PR 903

* Fix build after rebase

* Refactor adq patch (by gp) : lowering the solvers dependence to "state"

* Refactor adq patch (by gp) : lowering the solvers dependence to "state" (part 2)

* Refactor adq patch (by gp) : remove solveCSR from classic optimization problem

* Refactor adq patch (by gp) : correction after merge (to get compilation done)

* adq patch - refactor economy : renaming

* adq patch - refactor economy : define a weekyOptimization for each problemeHebdo

* solveCSR => implementation in separate file

* adq patch - refactor economy : correction to avoid conflict in the next merge

* adq patch - refactor economy : move declaration of class interfaceWeeklyOptimization in a new file

* adq patch - refactor economy : extract weekly optimization classes in separate source files

* adq patch - refactor economy : correction due to review

* adq patch - refactor economy : remove useless function arguments due to sonar review

* Fix build

* Restore function setBoundsAdqPatch

* Add virtual dtors

* Remove useless return statement

* Nested namespaces, formatting

* Make protected members const

Co-authored-by: Vincent Payet <vincent.payet@rte-france.com>
Co-authored-by: Florian OMNES <florian.omnes@rte-france.com>

* Adequacy patch :  refactor curtailment sharing (#971)

* Adequacy patch CSR - final (#958)

* change origin/extremityAreaType to AreaMode

* refacto function SetNTCForAdequacyFirstStep

* LinkCapacityForAdqPatchFirstStepFromAreaOutsideToAreaInsideAdq name change

* name change for LinkCapacityForAdequacyPatchFirstStep

* remove returnNTC form adq functions.

* remove unnecessary break

* make readAdqPatchMode function

* make ini file more expressive

* remove additional check for ini file

* refacto

* make version 8.3.0

* Revert "make version 8.3.0"

* fix

* fix

* synchronize names setToZeroNTCfrom..

* synchronize names pBtn...

* synchronize adequacy-patch-options.cpp

* synchronize names adqm..

* synchronize names AreaType to AreaMode

* synchronize names LinkCapacity..

* synchronize name physicalAreaInsideAdqPatch

* 1. do not modify Yuni library

* 3. AdequacyPatchPTO name change

* 3. update

* 2-8. replace seeds with two thresholds

* 9. resetAdqPatchParameters

* 10. re-name lmrViolations.h

* 25-26. re-name AdequacyPatchConfigure to AdequacyPatchOptions

* 27. cellValue change

* 28. is already implemented + small refacto

* small refacto

* 29. updateButton function

* 13. renaming

* 14. refactoring

* 15. remove redundancy

* 16. refactoring

* 20. separate LHS to functions

* 20. separate RHS to functions

* clean

* 23. separate Costs into functions

* 22. separate Bounds into functions

* 21. separate Construction of variables into functions

* 19. separate quad-solver into sub-functions

* 11. separate getHoursRequiringCurtailmentSharing into two sub-functions

* 17+18+24. make OPT_ functions private methods and make public run method

* clean

* clean

* clean

* 0 as a default value, and (value > threshold)

* 4. add else if for AdqPatchPTO::isDens

* bring back some debugg logs for easy result check

* 2. make calculateCsrParameters method of HOURLY_CSR_PROBLEM

* clean

* 1. use std::vector for sumENS

* 9. repack CSR ui input data in parameters.h

* 8. placing all functions inside adequacy_patch.h to namespace Adequcy patch

* 7. re-pack CSR run into weeklyOptProblem->solve method

* adopt RTE syntax for switch/case

* remove comments

* change RC number

* change beta release number

* unit test for CSR-calculateAreaFlowBalance

* small refacto

* unit test bug fix

* 4. remove unused

* 6.1 MemAllocMemset

* 5. remove return

* 3. remove debug log

* 2. move to csr

* 1. refacto

* 6.2 hide column

* 6.2

* 3. move log

* 3. move log..

* clean

* small fix year count

* hot start

* relax var bounds

* remove ENS <= densNew constraint, set as var bound

* remove set values to NaN if csr solver fails

* relax bining constrains for csr solver

* make csr crash log more expressive

* clean some logs

* beta 3 -> beta 4

* wrong relaxation of bc - bug fix

* logg out triggered csr hours

* refacto 1e-3

* logg out csr warnings - refacto

* update antares output dens value

* more expressive log

* update dens and use it as pto

* dont include linear cost coeff - temporary beta6 only

* beta5->beta6

* 10. bring back type of var to origin quad solver - mistake

* 2. remove default values for the solver accuracy

* change function  name to ADQ_PATCH_CSR

* 6. remove comments

* 7. remove nused transport cost

* 9. remove comments

* 11. refacto - int NumberOfVariables

* 8. remove NomDeLaContrainte

* bring back linear hurdle costs

* set to zero ENS & spillage if below threshold (avoid LOLP=100% dummy values)

* small refacto

* 4. make subfunction CSR_DEBUG_BLAH

* 1. move csr problem functions to separate directory

* 12. Add "Include hurdle cost" false/true button

* refacto avoid bugs

* refacto avoid bugs

* refacto bugs

* Fix build

Rename LinkCapacityForAdequacyPatchFirstStep -> ntcSetToZeroStatus_AdqPatchStep1

* 1. Make NumberOfVariables a reference var

* change function name CSR_DEBUG_

* 3. test Probleme.ExistenceDUneSolution directly

* 2. Slightly clearer version

* 4. make hoursRequiringCurtailmentSharing const var

* 5. avoid cast sumENS[i] to int!

* 17. move default thresholds to adequacy_patch.h

* 20. use A.size() in addArray function

* 19. create dedicated method solveCSR

* 7. name change

* 8. make methods of AdequacyPatchOptimization private

* 11. 14. 16 delete unused logs

* 9.  delete forward declaration of HOURLY_CSR_PROBLEM

* 15. remove Double definition.

* 12. 13 update copyright & Authors for adq-patch files

* make solveCSR private method

* use auto instead of std::unique_ptr<PROBLEME_POINT_INTERIEUR>

* float->double

* remove saveIntermediateResults

* code smells parameters.cpp

* critical-CodeSmell-adequacy_patch.cpp

* critical-codeSmells- set_problem_cost.cpp

* info-CodeSmell - remove todo-s

* CodeSmells - global var should be const

* NULL->nullptr

* use default destructor

* protected->private in adq-patch-area-grid.h

* use default constructor in adequacy-patch-areas

* Add the "explicit" keyword to AdequacyPatchAreas constructor

* NULL->nullptr in adequacy-patch-options.cpp

* = default, AdequacyPatchOptions

* Add the "explicit" keyword to AdequacyPatchOptions constructor

* Remove these useless parentheses

* Remove these useless parentheses

* Remove the unused parameter "weekNb",

* Move these 4 #include directives to the top of the file

* declaration shadows a local variable

* Value stored to 'ProblemeAResoudre' is never read

* function should be declared "const"

* Use "std::make_unique" to construct "std::unique_ptr

* Value stored to 'out' during its initialization is never read

* major-CodeSmells-adequacy-patch-options.cpp

* remove "never read" variables

* const& buttonType in updateButton

* Replace this "enum" with "enum class"  AdqPatchPTO

* double*->const double* in addArray

* MinorCodeSmell-s construct_LHS

* MinorCodeSmell-s construct_RHS

* MinorCodeSmell-s construct_variables

* MinorCodeSmell-s cost_function

* MinorCodeSmell-s set_var_bounds

* MinorCodeSmell-s solve_problem

* MinorCodeSmell-s economy.cpp

* Remove redundant public  access specifier

* Remove this redundant access specifier

* MinorCodeSmell-s adq-patch-unit-tests

* Concatenate  namespace with the nested ones.

* Use "override" or "final" instead of "virtual".

* Remove public redundant access specifier;

* MinorCodeSmell-s adequacy-patch-areas.h

* Concatenate namespace with the nested ones.

* Make the type of auto& study ; a reference-to-const

* MinorCodeSmell-s AdequacyPatchOptions

* "not"-> "!" , "and"-> "&&"

* beta 7

* create GUI for csr var relax button

* connect GUI to logic

* threshold e-3 >e-5

* fix (GUI wont pass smaller than 10^-6)

* Value stored to 'PaliersThermiquesDuPays' is never read

* "std::string" -> "std::string_view"

* make getHoursRequiringCurtailmentSharing const method

* remove unused var

* assign ProblemeAResoudre properly

* Reporting of DENS_new in GUI result for all hours

* Check CSR cost-fun-value prior&after CSR-opt - GUI

* refacto due to pre-calculating dens_new for all hours prior to csr optim

* add "SpilledenergyAfterCSR" column

* TODO: densNewValues

* Correction of MRG.PRICE Price Cap in hours LOLE>0.5 after CSR

* refacto "DENS_new" parameter calc, same thing at the end!?

* add DTG. MRG INT/FIN columns to GUI

* copy-paste spilled Energy values into spilled Energy values after CSR prior to CSR

* Check CSR cost value prior to and after - UNTESTED

* refacto on DTG MRG CSR columns GUI

* change log to info in "Check CSR cost value"

* test implementation csr fun cost prior/after

* refacto LMR violations according to the agreement with Daniel + clean

* csr-postProcess - adjust ENS value and calc dtgMrgCsr

* small refacto

* refacto - adjust mrgPrice after caclulating dtgMrgCsr and new Ens

* log update

* refacto setToZeroIfBelowThreshold

* update/refacto log csr-solver

* refacto logs @ solve_problem.cpp

* typo

* beta7 -> beta8

* add prefix [adq-patch] to info logs

* move adqPatchPostProcess after HydroRemix

* refactor + change -  storeOrDisregardInteriorPointResults

* beta 9.1

* refactor solveCSR

* add "- dtgMrg" to densNew formula

* beta 10

Co-authored-by: hugo-antoine-rtei <73881097+hugo-antoine-rtei@users.noreply.github.com>
Co-authored-by: rtei-pw <rtei-pw@rte-international.com>
Co-authored-by: rtei-pw <rtei-pw@github.com>
Co-authored-by: Florian OMNES <florian.omnes@rte-france.com>
Co-authored-by: Hugo ANTOINE (RTEi) <hugo.antoine@rte-international.com>

* [FIX] FIx compile error

* [FIX] Refactored var names

* [REFAC] Changed class and var names in economy.h/cpp

* [REFAC] More correction of PR 903

* Refactor adq patch (by gp) : lowering the solvers dependence to "state"

* Refactor adq patch (by gp) : lowering the solvers dependence to "state" (part 2)

* Refactor adq patch (by gp) : correction after merge (to get compilation done)

* adq patch - refactor economy : renaming

* Refactor adq patch (by gp) : remove solveCSR from classic optimization problem

* adq patch - refactor economy : define a weekyOptimization for each problemeHebdo

* adq patch - refactor economy : correction to avoid conflict in the next merge

* adq patch - refactor economy : move declaration of class interfaceWeeklyOptimization in a new file

* adq patch - refactor economy : extract weekly optimization classes in separate source files

* adq patch - refactor economy : correction due to review

* adq patch - refactor economy : remove useless function arguments due to sonar review

* adq patch - refactor csr : simplify and remove useless things

* adq patch - refactor csr : split adequacy_patch.h/.cpp into local matching and curtailment sharing sources files

* Clean up headers

Co-authored-by: Milos <97689304+Milos-RTEi@users.noreply.github.com>
Co-authored-by: hugo-antoine-rtei <73881097+hugo-antoine-rtei@users.noreply.github.com>
Co-authored-by: rtei-pw <rtei-pw@rte-international.com>
Co-authored-by: rtei-pw <rtei-pw@github.com>
Co-authored-by: Florian OMNES <florian.omnes@rte-france.com>
Co-authored-by: Hugo ANTOINE (RTEi) <hugo.antoine@rte-international.com>
Co-authored-by: Vincent Payet <vincent.payet@rte-france.com>

* Adequacy patch vincent final (#1087)

* [FIX] Namespace concatenation in src/solver/simulation/

* [DEV] Moved reset csr and lm in dedicated structs

* [DEV] Create class CsrQuadraticProblem and moved functions in

* [DEV] Refactored functions in CsrQuadraticProblem class

* [DEV] FIx reference

* Pass hourlyCsrProblem.hourInWeekTriggeredCsr, not hourlyCsrProblem

* Nested namespaces

* Fix build, use non-const ref in class `CsrQuadraticProblem`

* [DEV] Concatenate namespace before merge

Co-authored-by: Florian OMNES <florian.omnes@rte-france.com>

* Remove state from interpolateWaterValue

* [DEV] Concatenate namespace done (#1094)

* Check for incompatible hurdle cost options (#1096)

* [DEV] Add rte banner in files missing it (#1097)

* [FIX] Adequacy code smells (#1100)

* [FIX] First batch of code smell

* [FIX] More smell fixes

* [FIX] Fix nested if and fort

* [FIX] Remove using Antares::Data::AdequacyPatch and solved compiles errors related

* [FIX] More code smells

* [FIX] Compile errors

* [FIX] Clarify condition

* [CSR] Clarify implicit var convention (#1095)

* CSR : clarify implicit convention on variable numbers for links

* CSR: clarify debug logs

* Renaming after PR remarks

* Pass hour instead of hourlyCsrProblem (#1098)

* Pass hour instead of hourlyCsrProblem

* Pass int for hour instead of a struct containing it

* move calculation of LMR violations from CSR source file to adq patch weekly problem (#1102)

* Move var declaration to right scope (#1103)

* [FIX] Move var declaration to right scope

* Fix infinite loop, possible other bug (#1107)

* Preparatory refactor to use own instance of PROBLEME_A_RESOUDRE (#1099)

* Simplify UtiliserLaToleranceDAdmissibiliteParDefaut, etc.

* Use PROBLEME_POINT_INTERIEUR for calculateCsrCostFunctionValue

* Pass hour instead of HOURLY_CSR_PROBLEM&

* Use PROBLEME_POINT_INTERIEUR for CSR_DEBUG_HANDLE, handleInteriorPointError

* PR remarks (use ref on object, not unique_ptr)

* Rename HOURLY_CSR_PROBLEM -> HourlyCSRProblem

* Apply clang-format

* Move files

* Move csr_quadratic_problem.h,cpp

* Remove unused fwd declaration

* Don't instantiate HourlyCSRProblem for every hour, setHour instead

* Rename OPT_ConstruireLaMatriceDesContraintesDuProblemeQuadratique_CSR

* Use std::vector::data instead of malloc/free

* Some renaming

* Add forgotten '{'

* Use our own instance of `PROBLEME_ANTARES_A_RESOUDRE` (#1105)

* Simplify UtiliserLaToleranceDAdmissibiliteParDefaut, etc.

* Use PROBLEME_POINT_INTERIEUR for calculateCsrCostFunctionValue

* Pass hour instead of HOURLY_CSR_PROBLEM&

* Use PROBLEME_POINT_INTERIEUR for CSR_DEBUG_HANDLE, handleInteriorPointError

* PR remarks (use ref on object, not unique_ptr)

* Rename HOURLY_CSR_PROBLEM -> HourlyCSRProblem

* Apply clang-format

* Move files

* Move csr_quadratic_problem.h,cpp

* Remove unused fwd declaration

* Don't instantiate HourlyCSRProblem for every hour, setHour instead

* Rename OPT_ConstruireLaMatriceDesContraintesDuProblemeQuadratique_CSR

* Use std::vector::data instead of malloc/free

* Some renaming

* Use our own instance of PROBLEME_ANTARES_A_RESOUDRE

* Refactor 2 more functions

OPT_InitialiserLeSecondMembreDuProblemeQuadratique_CSR
OPT_ConstruireLaListeDesVariablesOptimiseesDuProblemeQuadratique_CSR

* Use reference instead of raw pointer

* Extract allocation function for PROBLEME_ANTARES_A_RESOUDRE

* Use std::fill_n instead of memset

* PR remark

* Extract OPT_FreeOptimizationData

* Handle memory allocation/deallocation

* UpperCamelCase for some classes, move sources to adequacy_patch_csr (#1108)

* [FIX] UpperCamelCase for some classes

* [FIX] Moved csr files in adequacy_patch_csr/

* [FIX] Swap DefaultWeeklyOptimization WeeklyOptimization names

* [FIX] Add Antares::Data::Optimization namespace

* Remove `OPT_*_CSR` functions (#1111)

* Remove OPT_*_CSR functions

* Rename hourInWeekTriggeredCsr -> triggeredHour

* Fix regression related to while loop and unitialized quadratic costs (#1112)

* Fix regression related to while loop

* Fix 2nd regression related to unitialized quadratic cost

* Fix build after merge

* Fix a few more code smells (#1113)

* Fix a few code smells

* Apply clang-format

* Remove unused function ResetButtonSpecify

* Code smells  (#1114)

* [FIX] Code smells

* Temporarily disable all release tests

* Use simtest v8.5.0b

* Version++, RC=1

* Fix version 8.5

* Add TODO in changelog

* Move "older versions" comment

* Update VCPKG cache key

* Update version here and there

* RC=2

* Update changelog

* Remove useless file

* Remove useless file (bis)

* RC=3

* Fix tests

---------

Co-authored-by: Milos <97689304+Milos-RTEi@users.noreply.github.com>
Co-authored-by: Milos A <milos.andjelkovic@redstork-solutions.com>
Co-authored-by: rtei-pw <rtei-pw@github.com>
Co-authored-by: Hugo ANTOINE (RTEi) <hugo.antoine@rte-international.com>
Co-authored-by: hugo-antoine-rtei <73881097+hugo-antoine-rtei@users.noreply.github.com>
Co-authored-by: payetvin <113102157+payetvin@users.noreply.github.com>
Co-authored-by: guilpier-code <62292552+guilpier-code@users.noreply.github.com>
Co-authored-by: Vincent Payet <vincent.payet@rte-france.com>
Co-authored-by: rtei-pw <rtei-pw@rte-international.com>
flomnes added a commit that referenced this pull request Feb 16, 2023
* unit test for CSR-calculateAreaFlowBalance

* small refacto

* unit test bug fix

* 4. remove unused

* 6.1 MemAllocMemset

* 5. remove return

* 3. remove debug log

* 2. move to csr

* 1. refacto

* 6.2 hide column

* 6.2

* 3. move log

* 3. move log..

* clean

* small fix year count

* hot start

* relax var bounds

* remove ENS <= densNew constraint, set as var bound

* remove set values to NaN if csr solver fails

* relax bining constrains for csr solver

* make csr crash log more expressive

* clean some logs

* beta 3 -> beta 4

* wrong relaxation of bc - bug fix

* logg out triggered csr hours

* refacto 1e-3

* logg out csr warnings - refacto

* update antares output dens value

* more expressive log

* update dens and use it as pto

* dont include linear cost coeff - temporary beta6 only

* beta5->beta6

* 10. bring back type of var to origin quad solver - mistake

* 2. remove default values for the solver accuracy

* change function  name to ADQ_PATCH_CSR

* 6. remove comments

* 7. remove nused transport cost

* 9. remove comments

* 11. refacto - int NumberOfVariables

* 8. remove NomDeLaContrainte

* bring back linear hurdle costs

* set to zero ENS & spillage if below threshold (avoid LOLP=100% dummy values)

* small refacto

* 4. make subfunction CSR_DEBUG_BLAH

* 1. move csr problem functions to separate directory

* 12. Add "Include hurdle cost" false/true button

* refacto avoid bugs

* refacto avoid bugs

* refacto bugs

* Fix build

Rename LinkCapacityForAdequacyPatchFirstStep -> ntcSetToZeroStatus_AdqPatchStep1

* 1. Make NumberOfVariables a reference var

* change function name CSR_DEBUG_

* 3. test Probleme.ExistenceDUneSolution directly

* 2. Slightly clearer version

* 4. make hoursRequiringCurtailmentSharing const var

* 5. avoid cast sumENS[i] to int!

* 17. move default thresholds to adequacy_patch.h

* 20. use A.size() in addArray function

* 19. create dedicated method solveCSR

* 7. name change

* 8. make methods of AdequacyPatchOptimization private

* 11. 14. 16 delete unused logs

* 9.  delete forward declaration of HOURLY_CSR_PROBLEM

* 15. remove Double definition.

* 12. 13 update copyright & Authors for adq-patch files

* make solveCSR private method

* use auto instead of std::unique_ptr<PROBLEME_POINT_INTERIEUR>

* float->double

* remove saveIntermediateResults

* code smells parameters.cpp

* critical-CodeSmell-adequacy_patch.cpp

* critical-codeSmells- set_problem_cost.cpp

* info-CodeSmell - remove todo-s

* CodeSmells - global var should be const

* NULL->nullptr

* use default destructor

* protected->private in adq-patch-area-grid.h

* use default constructor in adequacy-patch-areas

* Add the "explicit" keyword to AdequacyPatchAreas constructor

* NULL->nullptr in adequacy-patch-options.cpp

* = default, AdequacyPatchOptions

* Add the "explicit" keyword to AdequacyPatchOptions constructor

* Remove these useless parentheses

* Remove these useless parentheses

* Remove the unused parameter "weekNb",

* Move these 4 #include directives to the top of the file

* declaration shadows a local variable

* Value stored to 'ProblemeAResoudre' is never read

* function should be declared "const"

* Use "std::make_unique" to construct "std::unique_ptr

* Value stored to 'out' during its initialization is never read

* major-CodeSmells-adequacy-patch-options.cpp

* remove "never read" variables

* const& buttonType in updateButton

* Replace this "enum" with "enum class"  AdqPatchPTO

* double*->const double* in addArray

* MinorCodeSmell-s construct_LHS

* MinorCodeSmell-s construct_RHS

* MinorCodeSmell-s construct_variables

* MinorCodeSmell-s cost_function

* MinorCodeSmell-s set_var_bounds

* MinorCodeSmell-s solve_problem

* MinorCodeSmell-s economy.cpp

* Remove redundant public  access specifier

* Remove this redundant access specifier

* MinorCodeSmell-s adq-patch-unit-tests

* Concatenate  namespace with the nested ones.

* Use "override" or "final" instead of "virtual".

* Remove public redundant access specifier;

* MinorCodeSmell-s adequacy-patch-areas.h

* Concatenate namespace with the nested ones.

* Make the type of auto& study ; a reference-to-const

* MinorCodeSmell-s AdequacyPatchOptions

* "not"-> "!" , "and"-> "&&"

* Add adequacy-patch CSR study format changes (#817)

* beta 7

* create GUI for csr var relax button

* connect GUI to logic

* threshold e-3 >e-5

* fix (GUI wont pass smaller than 10^-6)

* Value stored to 'PaliersThermiquesDuPays' is never read

* "std::string" -> "std::string_view"

* make getHoursRequiringCurtailmentSharing const method

* remove unused var

* assign ProblemeAResoudre properly

* Reporting of DENS_new in GUI result for all hours

* Check CSR cost-fun-value prior&after CSR-opt - GUI

* refacto due to pre-calculating dens_new for all hours prior to csr optim

* add "SpilledenergyAfterCSR" column

* TODO: densNewValues

* Correction of MRG.PRICE Price Cap in hours LOLE>0.5 after CSR

* refacto "DENS_new" parameter calc, same thing at the end!?

* add DTG. MRG INT/FIN columns to GUI

* copy-paste spilled Energy values into spilled Energy values after CSR prior to CSR

* Check CSR cost value prior to and after - UNTESTED

* refacto on DTG MRG CSR columns GUI

* change log to info in "Check CSR cost value"

* test implementation csr fun cost prior/after

* refacto LMR violations according to the agreement with Daniel + clean

* csr-postProcess - adjust ENS value and calc dtgMrgCsr

* small refacto

* refacto - adjust mrgPrice after caclulating dtgMrgCsr and new Ens

* log update

* refacto setToZeroIfBelowThreshold

* update/refacto log csr-solver

* refacto logs @ solve_problem.cpp

* typo

* beta7 -> beta8

* add prefix [adq-patch] to info logs

* move adqPatchPostProcess after HydroRemix

* refactor + change -  storeOrDisregardInteriorPointResults

* beta 9.1

* refactor solveCSR

* add "- dtgMrg" to densNew formula

* beta 10

* fix error

* update 13-file-format.md for adq-patch CSR

* update 14-adequacy-patch.md for adq-patch CSR

* change CSR objective function (Elia)

* change CSR objective function (Elia) - doc update

* beta11

* change CSR objective function (Elia) - doc update

* 14-adq-patch-doc-bug fix (unrecognized characters)

* 14-adq-patch-doc-bug fix (unrecognized characters)-2

* Fix build (linking KO b/c of missing functions)

* Fix build

* Apply clang-format

* [UI] Fix build

* Fix code smells reported as bugs

* Use BOOST_CHECK_EQUAL to check equality (#1056)

To display a more expressive error message in case of failure, for example

src/tests/src/solver/optimisation/adequacy_patch.cpp(481): error: in "calculateAreaFlowBalanceForOneTimeStep_outside_inside_IncludeOut_negativeFlow_initEnsEqualTo0": check densNew == 0.1 has failed [0 != 0.10000000000000001]

* Adequacy patch refactoring (#962)

* [FIX] Refactored var names

* [REFAC] Changed class and var names in economy.h/cpp

* [REFAC] More correction of PR 903

* Fix build after rebase

Co-authored-by: Florian OMNES <florian.omnes@rte-france.com>

* Refactor adq patch (part 2) (#964)

* [FIX] Refactored var names

* [REFAC] Changed class and var names in economy.h/cpp

* [REFAC] More correction of PR 903

* Fix build after rebase

* Refactor adq patch (by gp) : lowering the solvers dependence to "state"

* Refactor adq patch (by gp) : lowering the solvers dependence to "state" (part 2)

* Refactor adq patch (by gp) : remove solveCSR from classic optimization problem

* Restore function setBoundsAdqPatch

* Fix build

Co-authored-by: Vincent Payet <vincent.payet@rte-france.com>
Co-authored-by: Florian OMNES <florian.omnes@rte-france.com>

* Adequacy patch : refactor economy (weekly optimization) (#968)

* [FIX] Refactored var names

* [REFAC] Changed class and var names in economy.h/cpp

* [REFAC] More correction of PR 903

* Fix build after rebase

* Refactor adq patch (by gp) : lowering the solvers dependence to "state"

* Refactor adq patch (by gp) : lowering the solvers dependence to "state" (part 2)

* Refactor adq patch (by gp) : remove solveCSR from classic optimization problem

* Refactor adq patch (by gp) : correction after merge (to get compilation done)

* adq patch - refactor economy : renaming

* adq patch - refactor economy : define a weekyOptimization for each problemeHebdo

* solveCSR => implementation in separate file

* adq patch - refactor economy : correction to avoid conflict in the next merge

* adq patch - refactor economy : move declaration of class interfaceWeeklyOptimization in a new file

* adq patch - refactor economy : extract weekly optimization classes in separate source files

* adq patch - refactor economy : correction due to review

* adq patch - refactor economy : remove useless function arguments due to sonar review

* Fix build

* Restore function setBoundsAdqPatch

* Add virtual dtors

* Remove useless return statement

* Nested namespaces, formatting

* Make protected members const

Co-authored-by: Vincent Payet <vincent.payet@rte-france.com>
Co-authored-by: Florian OMNES <florian.omnes@rte-france.com>

* Adequacy patch :  refactor curtailment sharing (#971)

* Adequacy patch CSR - final (#958)

* change origin/extremityAreaType to AreaMode

* refacto function SetNTCForAdequacyFirstStep

* LinkCapacityForAdqPatchFirstStepFromAreaOutsideToAreaInsideAdq name change

* name change for LinkCapacityForAdequacyPatchFirstStep

* remove returnNTC form adq functions.

* remove unnecessary break

* make readAdqPatchMode function

* make ini file more expressive

* remove additional check for ini file

* refacto

* make version 8.3.0

* Revert "make version 8.3.0"

* fix

* fix

* synchronize names setToZeroNTCfrom..

* synchronize names pBtn...

* synchronize adequacy-patch-options.cpp

* synchronize names adqm..

* synchronize names AreaType to AreaMode

* synchronize names LinkCapacity..

* synchronize name physicalAreaInsideAdqPatch

* 1. do not modify Yuni library

* 3. AdequacyPatchPTO name change

* 3. update

* 2-8. replace seeds with two thresholds

* 9. resetAdqPatchParameters

* 10. re-name lmrViolations.h

* 25-26. re-name AdequacyPatchConfigure to AdequacyPatchOptions

* 27. cellValue change

* 28. is already implemented + small refacto

* small refacto

* 29. updateButton function

* 13. renaming

* 14. refactoring

* 15. remove redundancy

* 16. refactoring

* 20. separate LHS to functions

* 20. separate RHS to functions

* clean

* 23. separate Costs into functions

* 22. separate Bounds into functions

* 21. separate Construction of variables into functions

* 19. separate quad-solver into sub-functions

* 11. separate getHoursRequiringCurtailmentSharing into two sub-functions

* 17+18+24. make OPT_ functions private methods and make public run method

* clean

* clean

* clean

* 0 as a default value, and (value > threshold)

* 4. add else if for AdqPatchPTO::isDens

* bring back some debugg logs for easy result check

* 2. make calculateCsrParameters method of HOURLY_CSR_PROBLEM

* clean

* 1. use std::vector for sumENS

* 9. repack CSR ui input data in parameters.h

* 8. placing all functions inside adequacy_patch.h to namespace Adequcy patch

* 7. re-pack CSR run into weeklyOptProblem->solve method

* adopt RTE syntax for switch/case

* remove comments

* change RC number

* change beta release number

* unit test for CSR-calculateAreaFlowBalance

* small refacto

* unit test bug fix

* 4. remove unused

* 6.1 MemAllocMemset

* 5. remove return

* 3. remove debug log

* 2. move to csr

* 1. refacto

* 6.2 hide column

* 6.2

* 3. move log

* 3. move log..

* clean

* small fix year count

* hot start

* relax var bounds

* remove ENS <= densNew constraint, set as var bound

* remove set values to NaN if csr solver fails

* relax bining constrains for csr solver

* make csr crash log more expressive

* clean some logs

* beta 3 -> beta 4

* wrong relaxation of bc - bug fix

* logg out triggered csr hours

* refacto 1e-3

* logg out csr warnings - refacto

* update antares output dens value

* more expressive log

* update dens and use it as pto

* dont include linear cost coeff - temporary beta6 only

* beta5->beta6

* 10. bring back type of var to origin quad solver - mistake

* 2. remove default values for the solver accuracy

* change function  name to ADQ_PATCH_CSR

* 6. remove comments

* 7. remove nused transport cost

* 9. remove comments

* 11. refacto - int NumberOfVariables

* 8. remove NomDeLaContrainte

* bring back linear hurdle costs

* set to zero ENS & spillage if below threshold (avoid LOLP=100% dummy values)

* small refacto

* 4. make subfunction CSR_DEBUG_BLAH

* 1. move csr problem functions to separate directory

* 12. Add "Include hurdle cost" false/true button

* refacto avoid bugs

* refacto avoid bugs

* refacto bugs

* Fix build

Rename LinkCapacityForAdequacyPatchFirstStep -> ntcSetToZeroStatus_AdqPatchStep1

* 1. Make NumberOfVariables a reference var

* change function name CSR_DEBUG_

* 3. test Probleme.ExistenceDUneSolution directly

* 2. Slightly clearer version

* 4. make hoursRequiringCurtailmentSharing const var

* 5. avoid cast sumENS[i] to int!

* 17. move default thresholds to adequacy_patch.h

* 20. use A.size() in addArray function

* 19. create dedicated method solveCSR

* 7. name change

* 8. make methods of AdequacyPatchOptimization private

* 11. 14. 16 delete unused logs

* 9.  delete forward declaration of HOURLY_CSR_PROBLEM

* 15. remove Double definition.

* 12. 13 update copyright & Authors for adq-patch files

* make solveCSR private method

* use auto instead of std::unique_ptr<PROBLEME_POINT_INTERIEUR>

* float->double

* remove saveIntermediateResults

* code smells parameters.cpp

* critical-CodeSmell-adequacy_patch.cpp

* critical-codeSmells- set_problem_cost.cpp

* info-CodeSmell - remove todo-s

* CodeSmells - global var should be const

* NULL->nullptr

* use default destructor

* protected->private in adq-patch-area-grid.h

* use default constructor in adequacy-patch-areas

* Add the "explicit" keyword to AdequacyPatchAreas constructor

* NULL->nullptr in adequacy-patch-options.cpp

* = default, AdequacyPatchOptions

* Add the "explicit" keyword to AdequacyPatchOptions constructor

* Remove these useless parentheses

* Remove these useless parentheses

* Remove the unused parameter "weekNb",

* Move these 4 #include directives to the top of the file

* declaration shadows a local variable

* Value stored to 'ProblemeAResoudre' is never read

* function should be declared "const"

* Use "std::make_unique" to construct "std::unique_ptr

* Value stored to 'out' during its initialization is never read

* major-CodeSmells-adequacy-patch-options.cpp

* remove "never read" variables

* const& buttonType in updateButton

* Replace this "enum" with "enum class"  AdqPatchPTO

* double*->const double* in addArray

* MinorCodeSmell-s construct_LHS

* MinorCodeSmell-s construct_RHS

* MinorCodeSmell-s construct_variables

* MinorCodeSmell-s cost_function

* MinorCodeSmell-s set_var_bounds

* MinorCodeSmell-s solve_problem

* MinorCodeSmell-s economy.cpp

* Remove redundant public  access specifier

* Remove this redundant access specifier

* MinorCodeSmell-s adq-patch-unit-tests

* Concatenate  namespace with the nested ones.

* Use "override" or "final" instead of "virtual".

* Remove public redundant access specifier;

* MinorCodeSmell-s adequacy-patch-areas.h

* Concatenate namespace with the nested ones.

* Make the type of auto& study ; a reference-to-const

* MinorCodeSmell-s AdequacyPatchOptions

* "not"-> "!" , "and"-> "&&"

* beta 7

* create GUI for csr var relax button

* connect GUI to logic

* threshold e-3 >e-5

* fix (GUI wont pass smaller than 10^-6)

* Value stored to 'PaliersThermiquesDuPays' is never read

* "std::string" -> "std::string_view"

* make getHoursRequiringCurtailmentSharing const method

* remove unused var

* assign ProblemeAResoudre properly

* Reporting of DENS_new in GUI result for all hours

* Check CSR cost-fun-value prior&after CSR-opt - GUI

* refacto due to pre-calculating dens_new for all hours prior to csr optim

* add "SpilledenergyAfterCSR" column

* TODO: densNewValues

* Correction of MRG.PRICE Price Cap in hours LOLE>0.5 after CSR

* refacto "DENS_new" parameter calc, same thing at the end!?

* add DTG. MRG INT/FIN columns to GUI

* copy-paste spilled Energy values into spilled Energy values after CSR prior to CSR

* Check CSR cost value prior to and after - UNTESTED

* refacto on DTG MRG CSR columns GUI

* change log to info in "Check CSR cost value"

* test implementation csr fun cost prior/after

* refacto LMR violations according to the agreement with Daniel + clean

* csr-postProcess - adjust ENS value and calc dtgMrgCsr

* small refacto

* refacto - adjust mrgPrice after caclulating dtgMrgCsr and new Ens

* log update

* refacto setToZeroIfBelowThreshold

* update/refacto log csr-solver

* refacto logs @ solve_problem.cpp

* typo

* beta7 -> beta8

* add prefix [adq-patch] to info logs

* move adqPatchPostProcess after HydroRemix

* refactor + change -  storeOrDisregardInteriorPointResults

* beta 9.1

* refactor solveCSR

* add "- dtgMrg" to densNew formula

* beta 10

Co-authored-by: hugo-antoine-rtei <73881097+hugo-antoine-rtei@users.noreply.github.com>
Co-authored-by: rtei-pw <rtei-pw@rte-international.com>
Co-authored-by: rtei-pw <rtei-pw@github.com>
Co-authored-by: Florian OMNES <florian.omnes@rte-france.com>
Co-authored-by: Hugo ANTOINE (RTEi) <hugo.antoine@rte-international.com>

* [FIX] FIx compile error

* [FIX] Refactored var names

* [REFAC] Changed class and var names in economy.h/cpp

* [REFAC] More correction of PR 903

* Refactor adq patch (by gp) : lowering the solvers dependence to "state"

* Refactor adq patch (by gp) : lowering the solvers dependence to "state" (part 2)

* Refactor adq patch (by gp) : correction after merge (to get compilation done)

* adq patch - refactor economy : renaming

* Refactor adq patch (by gp) : remove solveCSR from classic optimization problem

* adq patch - refactor economy : define a weekyOptimization for each problemeHebdo

* adq patch - refactor economy : correction to avoid conflict in the next merge

* adq patch - refactor economy : move declaration of class interfaceWeeklyOptimization in a new file

* adq patch - refactor economy : extract weekly optimization classes in separate source files

* adq patch - refactor economy : correction due to review

* adq patch - refactor economy : remove useless function arguments due to sonar review

* adq patch - refactor csr : simplify and remove useless things

* adq patch - refactor csr : split adequacy_patch.h/.cpp into local matching and curtailment sharing sources files

* Clean up headers

Co-authored-by: Milos <97689304+Milos-RTEi@users.noreply.github.com>
Co-authored-by: hugo-antoine-rtei <73881097+hugo-antoine-rtei@users.noreply.github.com>
Co-authored-by: rtei-pw <rtei-pw@rte-international.com>
Co-authored-by: rtei-pw <rtei-pw@github.com>
Co-authored-by: Florian OMNES <florian.omnes@rte-france.com>
Co-authored-by: Hugo ANTOINE (RTEi) <hugo.antoine@rte-international.com>
Co-authored-by: Vincent Payet <vincent.payet@rte-france.com>

* Adequacy patch vincent final (#1087)

* [FIX] Namespace concatenation in src/solver/simulation/

* [DEV] Moved reset csr and lm in dedicated structs

* [DEV] Create class CsrQuadraticProblem and moved functions in

* [DEV] Refactored functions in CsrQuadraticProblem class

* [DEV] FIx reference

* Pass hourlyCsrProblem.hourInWeekTriggeredCsr, not hourlyCsrProblem

* Nested namespaces

* Fix build, use non-const ref in class `CsrQuadraticProblem`

* [DEV] Concatenate namespace before merge

Co-authored-by: Florian OMNES <florian.omnes@rte-france.com>

* Remove state from interpolateWaterValue

* [DEV] Concatenate namespace done (#1094)

* Check for incompatible hurdle cost options (#1096)

* [DEV] Add rte banner in files missing it (#1097)

* [FIX] Adequacy code smells (#1100)

* [FIX] First batch of code smell

* [FIX] More smell fixes

* [FIX] Fix nested if and fort

* [FIX] Remove using Antares::Data::AdequacyPatch and solved compiles errors related

* [FIX] More code smells

* [FIX] Compile errors

* [FIX] Clarify condition

* [CSR] Clarify implicit var convention (#1095)

* CSR : clarify implicit convention on variable numbers for links

* CSR: clarify debug logs

* Renaming after PR remarks

* Pass hour instead of hourlyCsrProblem (#1098)

* Pass hour instead of hourlyCsrProblem

* Pass int for hour instead of a struct containing it

* move calculation of LMR violations from CSR source file to adq patch weekly problem (#1102)

* Move var declaration to right scope (#1103)

* [FIX] Move var declaration to right scope

* Fix infinite loop, possible other bug (#1107)

* Preparatory refactor to use own instance of PROBLEME_A_RESOUDRE (#1099)

* Simplify UtiliserLaToleranceDAdmissibiliteParDefaut, etc.

* Use PROBLEME_POINT_INTERIEUR for calculateCsrCostFunctionValue

* Pass hour instead of HOURLY_CSR_PROBLEM&

* Use PROBLEME_POINT_INTERIEUR for CSR_DEBUG_HANDLE, handleInteriorPointError

* PR remarks (use ref on object, not unique_ptr)

* Rename HOURLY_CSR_PROBLEM -> HourlyCSRProblem

* Apply clang-format

* Move files

* Move csr_quadratic_problem.h,cpp

* Remove unused fwd declaration

* Don't instantiate HourlyCSRProblem for every hour, setHour instead

* Rename OPT_ConstruireLaMatriceDesContraintesDuProblemeQuadratique_CSR

* Use std::vector::data instead of malloc/free

* Some renaming

* Add forgotten '{'

* Use our own instance of `PROBLEME_ANTARES_A_RESOUDRE` (#1105)

* Simplify UtiliserLaToleranceDAdmissibiliteParDefaut, etc.

* Use PROBLEME_POINT_INTERIEUR for calculateCsrCostFunctionValue

* Pass hour instead of HOURLY_CSR_PROBLEM&

* Use PROBLEME_POINT_INTERIEUR for CSR_DEBUG_HANDLE, handleInteriorPointError

* PR remarks (use ref on object, not unique_ptr)

* Rename HOURLY_CSR_PROBLEM -> HourlyCSRProblem

* Apply clang-format

* Move files

* Move csr_quadratic_problem.h,cpp

* Remove unused fwd declaration

* Don't instantiate HourlyCSRProblem for every hour, setHour instead

* Rename OPT_ConstruireLaMatriceDesContraintesDuProblemeQuadratique_CSR

* Use std::vector::data instead of malloc/free

* Some renaming

* Use our own instance of PROBLEME_ANTARES_A_RESOUDRE

* Refactor 2 more functions

OPT_InitialiserLeSecondMembreDuProblemeQuadratique_CSR
OPT_ConstruireLaListeDesVariablesOptimiseesDuProblemeQuadratique_CSR

* Use reference instead of raw pointer

* Extract allocation function for PROBLEME_ANTARES_A_RESOUDRE

* Use std::fill_n instead of memset

* PR remark

* Extract OPT_FreeOptimizationData

* Handle memory allocation/deallocation

* UpperCamelCase for some classes, move sources to adequacy_patch_csr (#1108)

* [FIX] UpperCamelCase for some classes

* [FIX] Moved csr files in adequacy_patch_csr/

* [FIX] Swap DefaultWeeklyOptimization WeeklyOptimization names

* [FIX] Add Antares::Data::Optimization namespace

* Remove `OPT_*_CSR` functions (#1111)

* Remove OPT_*_CSR functions

* Rename hourInWeekTriggeredCsr -> triggeredHour

* Fix regression related to while loop and unitialized quadratic costs (#1112)

* Fix regression related to while loop

* Fix 2nd regression related to unitialized quadratic cost

* Fix build after merge

* Fix a few more code smells (#1113)

* Fix a few code smells

* Apply clang-format

* Remove unused function ResetButtonSpecify

* Code smells  (#1114)

* [FIX] Code smells

* Temporarily disable all release tests

* Use simtest v8.5.0b

* Version++, RC=1

* Fix version 8.5

* Add TODO in changelog

* Move "older versions" comment

* Update VCPKG cache key

* Update version here and there

* RC=2

* Update changelog

* Remove useless file

* Remove useless file (bis)

* RC=3

* Fix tests

* Update changelog

* RC=0

* Fix LateX doc

---------

Co-authored-by: Milos <97689304+Milos-RTEi@users.noreply.github.com>
Co-authored-by: Milos A <milos.andjelkovic@redstork-solutions.com>
Co-authored-by: rtei-pw <rtei-pw@github.com>
Co-authored-by: Hugo ANTOINE (RTEi) <hugo.antoine@rte-international.com>
Co-authored-by: hugo-antoine-rtei <73881097+hugo-antoine-rtei@users.noreply.github.com>
Co-authored-by: payetvin <113102157+payetvin@users.noreply.github.com>
Co-authored-by: guilpier-code <62292552+guilpier-code@users.noreply.github.com>
Co-authored-by: Vincent Payet <vincent.payet@rte-france.com>
Co-authored-by: rtei-pw <rtei-pw@rte-international.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants