Skip to content

Commit

Permalink
few comments
Browse files Browse the repository at this point in the history
  • Loading branch information
payetvin committed Dec 31, 2024
1 parent 63d7935 commit c2ca5b7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
** along with Antares_Simulator. If not, see <https://opensource.org/license/mpl-2-0/>.
*/

#include "antares/study/parts/short-term-storage/additionalConstraints.h"

#include <algorithm>

#include "antares/study/parts/short-term-storage/additionalConstraints.h"

namespace Antares::Data::ShortTermStorage
{

Expand Down Expand Up @@ -59,8 +59,7 @@ bool SingleAdditionalConstraint::isValidHoursRange() const

bool AdditionalConstraints::isValidHours() const
{
return std::ranges::all_of(constraints.begin(),
constraints.end(),
return std::ranges::all_of(constraints,
[](const auto& constraint)
{ return constraint.isValidHoursRange(); });
}
Expand Down
6 changes: 3 additions & 3 deletions src/solver/simulation/sim_calcul_economique.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ static void importShortTermStorages(
std::vector<::ShortTermStorage::AREA_INPUT>& ShortTermStorageOut)
{
int clusterGlobalIndex = 0;
int clusterCumulativeConstraintGlobalIndex = 0;
int constraintGlobalIndex = 0;
for (uint areaIndex = 0; areaIndex != areas.size(); areaIndex++)
{
ShortTermStorageOut[areaIndex].resize(areas[areaIndex]->shortTermStorage.count());
Expand All @@ -65,8 +65,8 @@ static void importShortTermStorages(
{
for (auto& [_, globalIndex, __]: additionalConstraints.constraints)
{
globalIndex = clusterCumulativeConstraintGlobalIndex;
++clusterCumulativeConstraintGlobalIndex;
globalIndex = constraintGlobalIndex;
++constraintGlobalIndex;
}
}
toInsert.series = st.series;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -535,8 +535,7 @@ BOOST_AUTO_TEST_CASE(Validate_ValidConstraints)
ShortTermStorage::SingleAdditionalConstraint constraint2;
constraint2.hours = {100, 150, 168}; // Valid hours

constraints.constraints.push_back(constraint1);
constraints.constraints.push_back(constraint2);
constraints.constraints = {constraint1, constraint2};

auto [ok, error_msg] = constraints.validate();
BOOST_CHECK_EQUAL(ok, true);
Expand Down

0 comments on commit c2ca5b7

Please sign in to comment.