python 非线性最优化_Python约束的非线性优化

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})

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值