Skip to content

Commit

Permalink
fix constraint count
Browse files Browse the repository at this point in the history
  • Loading branch information
a-zakir committed Dec 18, 2024
1 parent db1e44f commit 2dc8d74
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/libs/antares/study/parts/short-term-storage/container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,6 @@ bool STStorageInput::LoadConstraintsFromIniFile(const fs::path& parent_path)
}
else if (key == "hours")
{
// std::string raw_value;
// value.to<std::string>(raw_value);
std::stringstream ss(value.c_str());
std::string hour;
while (std::getline(ss, hour, ','))
Expand All @@ -129,9 +127,9 @@ bool STStorageInput::LoadConstraintsFromIniFile(const fs::path& parent_path)

if (!constraint.validate())
{
logs.error() << "Invalid constraint in section: " << section->name;
logs.error() << constraint.getErrorMessage();
return false;
throw std::runtime_error(
"Invalid constraint in section: " + section->name + "\n" + constraint.
getErrorMessage());
}

auto it = std::find_if(storagesByIndex.begin(),
Expand Down Expand Up @@ -197,10 +195,10 @@ std::size_t STStorageInput::cumulativeConstraintCount() const
{
return std::accumulate(storagesByIndex.begin(),
storagesByIndex.end(),
0.,
[](double acc, const auto& cluster)
0,
[](int acc, const auto& cluster)
{
return cluster.additional_constraints.size();
return acc + cluster.additional_constraints.size();
});
}

Expand Down

0 comments on commit 2dc8d74

Please sign in to comment.