mixed integer quadratic programming in python

自作多情 提交于 2021-01-29 05:16:08

问题


I was wondering if someone could give me some guidance in setting up my objective.

I am trying to minimise variance in python with some cardinality constraints on the number of assets in my portfolio. I am not sure what package would help me do this. And if there was a working example for the above.


回答1:


Below is a MIQP model that illustrates how we can model a portfolio problem with the number assets limited to be between minAssets and maxAssets. If an asset is in the portfolio, furthermore its fraction is limited to be between fmin and fmax.

In this link you can also see how you can try to solve this problem with just a series of linear MIP problems.

MIQP solvers are readily available: CVXPY/ECOS_BB, Cplex, and Gurobi are a few examples. These are all callable from Python. A simple portfolio QP model would be a good starting point (no doubt such a model is available in the examples for any of these solvers).




回答2:


You may have a look at some links, which are about python package CVXOPT:

https://cvxopt.org/examples/book/portfolio.html

https://scaron.info/blog/quadratic-programming-in-python.html



来源:https://stackoverflow.com/questions/54288030/mixed-integer-quadratic-programming-in-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!