lin prog optimization with recourse function.

1 visualizzazione (ultimi 30 giorni)
bus14
bus14 il 2 Mag 2019
Commentato: Torsten il 8 Mag 2019
Hi community, I have a problem with constructing the right code. Where I first want to minimize a code using linprog to find values for Y & Z and thereafter want to use these obtained values of Z & Y to find an optimal value for X.
%first stage making expectation of second stage to determine x
%Min c.'*x+E[Q(x,D)]
i=1;
j=1;
c = 3;
l = 0.25;
q = 11;
s = 2;
A1 = 1;
D= 100;
x1=110
f2 = [-s.',(l-q).']; %[ Y, Z]
E=sum(f2) %value for expected optimum solution Q(x,D)
Aeq = [eye(j),A1.'];
beq = x1;
lb = [zeros(1,i+j)]; %requires 4 bounds as there are 4 variables --> for versatility lb=[zeros(1,v) v= number of variables in V
ub = [inf(1,j),D];
sol = linprog(f2,[],[],Aeq,beq,lb,ub);
y = sol(1)
z = sol(2)
%V=[V1 V2 V3]= [X Y Z]
f1= [c.',-s.',(l-q).'];
Aeq = [0,eye(j), A1.'];
beq = [x];
lb = [0,0,0];%x>0
ub = [Inf,inf,D]; ?
sol = linprog(f1,[],[],Aeq,beq,lb,ub)
x = sol(1)
from the second linprog I only want a solution for the value of X, since the values of Z & Y should be the same as obtained from the f2 Linprog function. I do not now How to fix that the second linprog f1 uses the values obtained from optimization f2. As now As result of optimization f1 I get X=Y=Z=0. which is not satisfactory. Does anyone have an idea how I can fix this?
Thankyou!
  20 Commenti
bus14
bus14 il 8 Mag 2019
Modificato: bus14 il 8 Mag 2019
Was in a bit of a hurry...
What I meant was:
Aeq=[-ones(200,1),eye(200),eye(200)];
beq = [zeros(200,1)];
Now new problems rise as the number of columns of Aeq must be the same as the number elements in f
f2 = [c';pk(k)*-s.';pk(k)*(l-q).']
However, without running the for loop. This ofcourse has only 3 elements. Is there a trick I can use to repeat this for the objective function f2 to put all 200 situation in them instead of just typing it out?
because there are indeed 200 instances of y(k) and 200 instances of z(k) do not know how to put this into f2.
Torsten
Torsten il 8 Mag 2019
I did not write pk(k), but Pk which is
Pk = [pk(1);pk(2);pk(3);...;pk(200)]

Accedi per commentare.

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by