I'm on Scipy Optimize, using the fmin_cobyla function. I've struggled to write constraint functions that:
- make sure all items sum up to 1
- make sure all items >= 0
Does anyone have insight? For fmin_slsqp, for example, I had a function:
def w_constraint(w, v, x0, x1):
return np.sum(w) - 1
As well as bounds in the function.
But these don't work on cobyla.