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

New hydro remix algorithm #2532

Open
wants to merge 44 commits into
base: develop
Choose a base branch
from
Open

Conversation

guilpier-code
Copy link
Contributor

No description provided.

@guilpier-code guilpier-code marked this pull request as draft December 13, 2024 09:08
BOOST_CHECK(new_H == expected_H);
BOOST_CHECK(new_D == expected_D);
}

Copy link
Contributor

Choose a reason for hiding this comment

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

J'ai l'impression que ce test est très similaire au test précédent.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oui, en effet, la seule chose qui change, c'est la Pmax qui est maintenant de 50 (au lieu de 40).
D'ou le titre de ce 2eme test

std::vector<double> expected_D = {20., 30., 40., 50., 60.};
BOOST_CHECK(new_H == expected_H);
BOOST_CHECK(new_D == expected_D);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Lui aussi ressemble beaucoup au précédent

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oui, ce test est le symétrique du test hydro_increases_and_pmax_40mwh___H_is_flattened_to_mean_H_20mwh
C'est pour montrer que l'algo est lui-même symétrique

return std::ranges::all_of(v, [&c](const double& e) { return e >= c; });
}

static void checkInputCorrectness(const std::vector<double>& G,
Copy link
Contributor

Choose a reason for hiding this comment

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

Several functions have a lots of args, maybe creating a struct to encapsulate the data will be simpler ?

Copy link
Contributor Author

@guilpier-code guilpier-code Jan 6, 2025

Choose a reason for hiding this comment

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

I don't know what its better : have many and detailed input arguments, or have a unique input struct argument encapsulating a list of many input data.
Having an input struct as argument may have a disadvantage :
we first have to pack input data into the struct, and then, inside the algorithm, we have to unpack the arguments, meaning we have to call input.someData or input.someOtherData, etc.
It may require more lines of code to do that.
I'm not sure it worth it to have a struct as input

@guilpier-code guilpier-code marked this pull request as ready for review January 7, 2025 14:20
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.

  1. Add a new CMake target
  2. Renaming "hydro-remix-new" -> better name

std::vector<double> levels;
};

RemixHydroOutput new_remix_hydro(const std::vector<double>& DispatchGen,
Copy link
Member

Choose a reason for hiding this comment

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

Change name + camelCase

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

const std::vector<double>& DTG_MRG)
{
std::vector<double> levels(DispatchGen.size());
if (levels.size())
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (levels.size())
if (!levels.empty())

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

@guilpier-code
Copy link
Contributor Author

  1. Add a new CMake target
  2. Renaming "hydro-remix-new" -> better name

Done

Copy link

sonarqubecloud bot commented Jan 9, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

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.

4 participants