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

Normalize simulation mode Expansion, fix logs #1771

Merged
merged 4 commits into from
Dec 11, 2023
Merged

Conversation

flomnes
Copy link
Member

@flomnes flomnes commented Nov 15, 2023

Goal of this PR

The goal of this PR is to normalize mode Expansion. Until now, it was a sort of hack for antares-xpansion.

Simulation mode Expansion is Economy, but with a single optimization instead of 2 optimizations + thermal heuristic for Economy / Adequacy.

Functional changes

  • Do not force the export of MPS files in Xpansion mode. MPS files still be enabled through the "include-exportmps" parameter, as usual
  • Allow the export of simulation results (mc-ind & mc-all) in Xpansion mode. As usual, can be enabled through settings year-by-year and synthesis, with suffix "exp" for the output directory (e.g 20231117-0931exp)
  • Fix logs, display "Expansion" instead of "Economy"

Technical changes

  • Allow Parameters::mode = stdmExpansion (renamed SimulationMode::Expansion)
  • Use enum class ("scoped enum") instead of C-style enum. Remove stdmMax
  • Remove bool Parameters::expansion
  • Remove file xpansion.h and constant STUDY_MODE_EXPANSION
  • Factorize two switch..case
switch (a) {
 case A:
+case B:
   someCode(); 
  break;
-case B:
-  someCode();
-  break;  
}

TODO

Generates tests results for new studies in mode expansion
AntaresSimulatorTeam/Antares_Simulator_Tests_NR#10

@flomnes flomnes linked an issue Nov 15, 2023 that may be closed by this pull request
src/libs/antares/study/parameters.cpp Show resolved Hide resolved
src/solver/simulation/sim_calcul_economique.cpp Outdated Show resolved Hide resolved
src/ui/simulator/windows/inspector/constants.cpp Outdated Show resolved Hide resolved
@JasonMarechal25
Copy link
Contributor

Just a note.
In xpansion we use both "expansion" and "economy" mode.

If user set xpansion mode "accurate" we use "expansion" in simulator, else "economy"

@flomnes flomnes added bug Something isn't working enhancement New feature or request labels Nov 16, 2023
@pull-request-size pull-request-size bot added size/L and removed size/M labels Nov 17, 2023
@flomnes flomnes changed the title Fix expansion logs, clean up & refactor Normalize simulation mode Expansion, fix logs Nov 17, 2023
//! Expansion
stdmExpansion,
Copy link
Member

Choose a reason for hiding this comment

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

Not necessarily for that PR, but should we rename it something more generic, like "ProblemsGeneration" ? I don't know enough the specifics of this mode to find an appropriate name though.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, this may be renamed

@@ -110,8 +110,7 @@ bool runWeeklyOptimization(const OptimizationOptions& options,
writer))
return false;

if (problemeHebdo->ExportMPS != Data::mpsExportStatus::NO_EXPORT
|| problemeHebdo->Expansion)
if (problemeHebdo->ExportMPS != Data::mpsExportStatus::NO_EXPORT)
Copy link
Contributor

Choose a reason for hiding this comment

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

SimulationMode shouldn't be checked also ?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, this is the goal of this PR. To de-correlate the MPS export & the simulation mode

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 1 Code Smell

8.1% 8.1% Coverage
0.0% 0.0% Duplication

@flomnes flomnes merged commit cbd55e5 into develop Dec 11, 2023
7 checks passed
@flomnes flomnes deleted the fix/expansion-mode branch December 11, 2023 15:48
flomnes added a commit that referenced this pull request Dec 18, 2023
* Fix expansion logs, clean up & refactor

* Use enum class SimulationMode instead of enum StudyMode

* Do not force MPS export when Expansion mode is enabled
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong simulation mode when using CLI option --expansion
5 participants