finding value of x in linprog

2 ビュー (過去 30 日間)
bus14
bus14 2019 年 5 月 6 日
コメント済み: bus14 2019 年 5 月 6 日
Hi community, In my linprog to find an optimal value of x. I got an error that my x was undefined. However, This x should be found by running the linprog. I do not know how I can fix this. As in other linprogs I used it was fine using an unknown in the constraint. The code that I used is:
i=1;
j=1;
c=3;
l=1;
q=14;
s=2;
A1=1;
D=100;
y=10;
z=100;
%objective function is Min c'*x st. y+A1'*z=x x>0 y>0 0<=z<=d
f=[c.'];
Aeq=[y+A1.'*z];
beq=[x];
lb=[0];
ub=[inf];
sol=linprog(f,[],[],Aeq,beq,lb,ub);
x=sol(1)
Problem is that Matlab returns error for an undefined x. is there anyway I can solve this without giving a predetermined value for x? Cause I want to find an x which both satisfies the constraint as the objective function
Thank you!
  1 件のコメント
bus14
bus14 2019 年 5 月 6 日
I do not understand how this is possible as the linprog should find the optimal value for this x that is to this point unknown. I really hope someone can explain me why this is not working at the moment. Or where in my code there is a mistake.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeSolver Outputs and Iterative Display についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by