diff --git a/src/solver/simulation/shave-peaks-by-remix-hydro.cpp b/src/solver/simulation/shave-peaks-by-remix-hydro.cpp index 5ad4823add..99a8f2aa55 100644 --- a/src/solver/simulation/shave-peaks-by-remix-hydro.cpp +++ b/src/solver/simulation/shave-peaks-by-remix-hydro.cpp @@ -18,7 +18,7 @@ int find_min_index(const std::vector& 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]) { @@ -42,7 +42,7 @@ int find_max_index(const std::vector& 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]) @@ -59,9 +59,9 @@ int find_max_index(const std::vector& TotalGen, static bool operator<=(const std::vector& a, const std::vector& b) { - std::vector a_minus_b; - std::ranges::transform(a, b, std::back_inserter(a_minus_b), std::minus()); - return std::ranges::all_of(a_minus_b, [](const double& e) { return e <= 0.; }); + return a.size() == b.size() + && 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& v, const double c)