atomica.optimization.constrain_sum_bounded¶
- atomica.optimization.constrain_sum_bounded(x, s, lb, ub)[source]¶
Bounded nearest constraint sum
- Parameters:
x (
array) – Array of proposed values to constrains (
float) – Target value forsum(x)lb (
array) – Array of lower bounds, same size as xub (
array) – Array of upper bounds, same size as xtolerance – Absolute tolerance for the constrained sum
s
- Return type:
array- Returns:
Array same size as
x, such thatsum(x)==sandx[i]>=lbandx[i]<=ubfori<len(x)- Raises:
FailedConstraintif it was not possible to constrain