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
Image Analyst 2022 年 1 月 9 日
linpro()? But you used ling().
[x opt]=ling(-c,A,b)
dpb
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 ExchangeProblem-Based Optimization Setup についてさらに検索

質問済み:

2022 年 1 月 9 日

コメント済み:

dpb
2022 年 1 月 9 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by