![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/411263/image.png)
Mixed-Integer Linear Programming problem
8 次查看(过去 30 天)
显示 更早的评论
Hello,
i have to solve the following MILP problem on MATLAB:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/408525/image.png)
I have tried to solve it in this way, but there is something wrong because the are not solutions according to the solver but there should be 2 vectors with 4 solutions each. Can anyone help me?
q = 4
n = length(tickers)
cvx_begin
cvx_solver sdpt3
variables x(n) y(n) binary;
maximize (sum(sum(rho*x)))
sum(y) == q;
sum(x) == 1;
sum(x) <= y';
cvx_end
x, y
0 个评论
回答(1 个)
Pranav Verma
2020-11-12
Hi Nicolo'
You can use the MILP solver in MATLAB to solve the problem you have mentioned. The MILP solver solves:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/411263/image.png)
So make sure that you convert your problem from maximize to minimize and accordingly change the signs in the constraints and convert them to A.x <= b.
Thanks
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!