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

Small improvements for hydro remix #2570

Merged
merged 1 commit into from
Jan 10, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/solver/simulation/shave-peaks-by-remix-hydro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ int find_min_index(const std::vector<double>& TotalGen,
{
double min_val = top;
int min_hour = -1;
for (int h = 0; h < TotalGen.size(); ++h)
for (unsigned int h = 0; h < TotalGen.size(); ++h)
{
if (OutUnsupE[h] > 0 && OutHydroGen[h] < HydroPmax[h] && !triedBottom[h] && enabledHours[h])
{
Expand All @@ -42,7 +42,7 @@ int find_max_index(const std::vector<double>& TotalGen,
{
double max_val = 0;
int max_hour = -1;
for (int h = 0; h < TotalGen.size(); ++h)
for (unsigned int h = 0; h < TotalGen.size(); ++h)
{
if (OutHydroGen[h] > HydroPmin[h] && TotalGen[h] >= ref_value + eps && !triedPeak[h]
&& enabledHours[h])
Expand All @@ -59,9 +59,9 @@ int find_max_index(const std::vector<double>& TotalGen,

static bool operator<=(const std::vector<double>& a, const std::vector<double>& b)
{
std::vector<double> a_minus_b;
std::ranges::transform(a, b, std::back_inserter(a_minus_b), std::minus<double>());
return std::ranges::all_of(a_minus_b, [](const double& e) { return e <= 0.; });
return a.size() == b.size()
flomnes marked this conversation as resolved.
Show resolved Hide resolved
&& std::ranges::all_of(std::views::iota(size_t{0}, a.size()),
[&](size_t i) { return a[i] <= b[i]; });
}

static bool operator<=(const std::vector<double>& v, const double c)
Expand Down
Loading