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)==s
andx[i]>=lb
andx[i]<=ub
fori<len(x)
- Raises:
FailedConstraint
if it was not possible to constrain