What's the recommended package for constrained non-linear optimization in python ?
The specific problem I'm trying to solve is this:
I have an unknown X
(Nx1), I have M
(Nx1) u
vectors and M
(NxN) s
matrices.
max [5th percentile of (ui_T*X), i in 1 to M]
st
0<=X<=1 and
[95th percentile of (X_T*si*X), i in 1 to M]<= constant
When I started out the problem I only had one point estimate for u
and s
and I was able to solve the problem above with cvxpy
.
I realized that instead of one estimate for u
and s
, I had the entire distribution of values so I wanted to change my objective function so that I could use the entire distribution. The problem description above is my attempt to include that information in a meaningful way.
cvxpy
cannot be used to solve this, I've tried scipy.optimize.anneal
, but I can't seem to set bounds on the unknown values. I've looked at pulp
too but it doesnt allow nonlinear constraints.
scipy
has a spectacular package for constrained non-linear optimization.
You can get started by reading the optimize
doc, but here's an example with SLSQP:
minimize(func, [-1.0,1.0], args=(-1.0,), jac=func_deriv, constraints=cons, method='SLSQP', options={'disp': True})