Azzera filtri
Azzera filtri

finding value of x in linprog

2 visualizzazioni (ultimi 30 giorni)
bus14
bus14 il 6 Mag 2019
Commentato: bus14 il 6 Mag 2019
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 Commento
bus14
bus14 il 6 Mag 2019
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.

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Get Started with Optimization Toolbox in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by