Effacer les filtres
Effacer les filtres

finding value of x in linprog

2 vues (au cours des 30 derniers jours)
bus14
bus14 le 6 Mai 2019
Commenté : bus14 le 6 Mai 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 commentaire
bus14
bus14 le 6 Mai 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.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Get Started with Optimization Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by