Skip to content

Commit

Permalink
Correct cluster count, load constraints even for disabled clusters [A…
Browse files Browse the repository at this point in the history
…NT-2746] (#2659)
  • Loading branch information
payetvin authored Feb 25, 2025
1 parent b6765d0 commit 4b12e99
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ void BindingConstraint::weight(const AreaLink* lnk, double w)

void BindingConstraint::weight(const ThermalCluster* cluster, double w)
{
if (cluster && cluster->isActive())
if (cluster)
{
if (Math::Zero(w))
{
Expand Down Expand Up @@ -196,7 +196,7 @@ void BindingConstraint::offset(const AreaLink* lnk, int o)

void BindingConstraint::offset(const ThermalCluster* cluster, int o)
{
if (cluster && cluster->isActive())
if (cluster)
{
if (Math::Zero(o))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ inline uint BindingConstraint::linkCount() const

inline uint BindingConstraint::clusterCount() const
{
return (uint)pClusterWeights.size();
return std::ranges::count_if(pClusterWeights,
[](const std::pair<const Data::ThermalCluster*, double>& coeff)
{ return coeff.first->isActive(); });

}

inline bool BindingConstraint::enabled() const
Expand Down

0 comments on commit 4b12e99

Please sign in to comment.