Skip to content

Commit

Permalink
update outer-inner constraint count
Browse files Browse the repository at this point in the history
  • Loading branch information
a-zakir committed Dec 20, 2024
1 parent 88698d4 commit ffb6a42
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/libs/antares/study/area/list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1201,7 +1201,7 @@ bool AreaList::loadFromFolder(const StudyLoadOptions& options)
ret;

const auto constraints_folder = stsFolder / "constraints" / area->id.c_str();
ret = area->shortTermStorage.LoadConstraintsFromIniFile(cluster_folder) && ret;
ret = area->shortTermStorage.LoadConstraintsFromIniFile(constraints_folder) && ret;
}
}
else
Expand Down
25 changes: 18 additions & 7 deletions src/libs/antares/study/parts/short-term-storage/container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,13 @@ bool STStorageInput::LoadConstraintsFromIniFile(const fs::path& parent_path)
++localIndex;
}
}

// try to read the rhs
loadFile(parent_path / ("rhs_" + additional_constraints.name + ".txt"),
additional_constraints.rhs);
fillIfEmpty(additional_constraints.rhs, 0.0);
}

// try to read the rhs
loadFile(parent_path / ("rhs_" + additional_constraints.name + ".txt"),
additional_constraints.rhs);
fillIfEmpty(additional_constraints.rhs, 0.0);

if (auto [ok, error_msg] = additional_constraints.validate(); !ok)
{
logs.error() << "Invalid constraint in section: " << section->name;
Expand Down Expand Up @@ -229,8 +229,19 @@ std::size_t STStorageInput::cumulativeConstraintCount() const
return std::accumulate(storagesByIndex.begin(),
storagesByIndex.end(),
0,
[](int acc, const auto& cluster)
{ return acc + cluster.additional_constraints.size(); });
[](size_t outer_constraint_count, const auto& cluster)
{
return outer_constraint_count + std::accumulate(
cluster.additional_constraints.begin(),
cluster.additional_constraints.end(),
0,
[](size_t inner_constraint_count,
const auto& additional_constraints)
{
return inner_constraint_count +
additional_constraints.constraints.size();
});
});
}

std::size_t STStorageInput::count() const
Expand Down

0 comments on commit ffb6a42

Please sign in to comment.