can the variables be negative ?
显示 更早的评论
i have maximize the function below
z=0.75x1+0.91x2+0.98x3;
subject to
150x1+275x2+310x3<=1000
3.75x1+4.55x2+4.90x3<=1000
150x1+275x2<=500
i tried to find out the value using linpro() function
[x opt]=ling(-c,A,b)
x1= 775.7752
x2=-421.3319
opt=-200
2 个评论
Image Analyst
2022-1-9
linpro()? But you used ling().
[x opt]=ling(-c,A,b)
dpb
2022-1-9
If course if there are no bounds specified (as there weren't)
Keep reading the documentation for all the variations -- you need the one at least with
x = linprog(f,A,b,Aeq,beq,lb,ub) defines a set of lower and upper bounds on the design variables, x, so that the solution is always in the range lb ≤ x ≤ ub. Set Aeq = [] and beq = [] if no equalities exist.
to specify the lb array.
Your sample code above is full of typos and missing variables; I didn't try to fix it to be able to run it...
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Problem-Based Optimization Setup 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!