finding value of x in linprog

1 次查看(过去 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 CenterFile Exchange 中查找有关 Get Started with Optimization Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by