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

Remove duplication in simulation run #2274

Merged
merged 11 commits into from
Aug 23, 2024

Conversation

guilpier-code
Copy link
Contributor

@guilpier-code guilpier-code commented Jul 19, 2024

This work just started...

Situation :
There are code duplications :

  • When running the simulation, functions we use to do it (runSimulationInEconomicMode() and runSimulationInAdequacyMode()) are very much the same, the only difference is the C++ type of simulation (economy vs adequacy).
  • The way simulation is run from API or from classic Application look pretty close as well : see methods APIInternal::execute() and Application::execute().

Problem :
Difficult to remove the first duplication without removing the second one.

Purpose :
Remove them both.

@@ -95,6 +96,9 @@ class Application final: public Yuni::IEventObserver<Application, Yuni::Policy::
void runSimulationInAdequacyMode();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These methods are about to be removed

void runSimulationInAdequacyMode();
void runSimulationInEconomicMode();

Copy link
Member

Choose a reason for hiding this comment

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

Why not now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

now removed

src/api/API.cpp Show resolved Hide resolved
@@ -104,8 +105,6 @@ SimulationResults APIInternal::execute() const
// Importing Time-Series if asked
study_->importTimeseriesIntoInput();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

study_->importTimeseriesIntoInput();

Do we need this in API ?

Copy link
Member

Choose a reason for hiding this comment

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

Probably not

Copy link

@guilpier-code guilpier-code force-pushed the fix/remove-duplication-simulation-run branch from 063ae29 to 1694e4c Compare August 23, 2024 11:45
@pull-request-size pull-request-size bot added size/L and removed size/M labels Aug 23, 2024
@guilpier-code guilpier-code marked this pull request as ready for review August 23, 2024 13:28
@guilpier-code guilpier-code requested a review from flomnes August 23, 2024 13:28
Copy link
Member

@flomnes flomnes left a comment

Choose a reason for hiding this comment

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

Minor remarks

@@ -104,8 +105,6 @@ SimulationResults APIInternal::execute() const
// Importing Time-Series if asked
study_->importTimeseriesIntoInput();
Copy link
Member

Choose a reason for hiding this comment

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

Probably not

Comment on lines 24 to 25
#include "antares/solver/simulation/adequacy.h"
#include "antares/solver/simulation/economy.h"
Copy link
Member

Choose a reason for hiding this comment

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

These headers are not required here, please move them to simulation-runner.cpp

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, they will have to be moved to simulation-runner.cpp, where they are needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

src/solver/simulation/simulation-runner.cpp Outdated Show resolved Hide resolved
src/solver/simulation/simulation-runner.cpp Outdated Show resolved Hide resolved
Copy link

@flomnes flomnes dismissed JasonMarechal25’s stale review August 23, 2024 16:30

All comments were taken into account

@flomnes flomnes merged commit f206d45 into develop Aug 23, 2024
8 checks passed
@flomnes flomnes deleted the fix/remove-duplication-simulation-run branch August 23, 2024 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants