Solving Constrained Optimization for 4 variables (or 3?)
显示 更早的评论
I am trying to solve the question from the picture below.

I dont know how to modify the original code from solving 2 variables into solving 4 variables. My friend said it was supposedly only 3 variables (x4 supposedly was x3), maybe because the typo.
There are my Matlab code
回答(1 个)
It's a simple linear optimization problem. If you are allowed to, use "linprog" to solve.
f = [1; 1; 1; 0];
Aeq = [3 1 0 -1;1 -2 1 0];
beq = [-5;1];
lb = [-Inf; 0 ;0 ;0];
ub = [Inf ;Inf; Inf ;Inf];
sol = linprog(f,[],[],Aeq,beq,lb,ub)
7 个评论
Tristofani Agasta
2022-4-8
编辑:Tristofani Agasta
2022-4-8
Tristofani Agasta
2022-4-8
Torsten
2022-4-8
Is there any reason not to use linprog ?
Tristofani Agasta
2022-4-8
编辑:Tristofani Agasta
2022-4-8
Tristofani Agasta
2022-4-8
类别
在 帮助中心 和 File Exchange 中查找有关 Linear Programming and Mixed-Integer Linear Programming 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!