Here it was suggested to use mathematical transforms to impose hard constraints on search variables in the SLSQP
algorithm in scipy.optimize.minimize
. I assume more algorithms that allow constraints take them more as suggestions than hard facts, and it is not even just a python question at this point.
So in my case, I have a hard constraint where the individual search variables x0, x1, x2, x3 ...
and their sum in particular combinations must be constrained to an interval, say 0..1
. More specifically, the constraint is that the sum 1 - k*x0 +k*x1 -k*x2 -c0 +k*x3 -k*x4 -c1 ...
should be in the interval 0 .. 1
for every step of the way. You can use sigmoid functions to transform the search space into an interval. But with many such functions in combinations, that becomes infeasible - right?
What is the proper way to impose hard limitations on simple summation combinations of search variables?