lin prog optimization with recourse function.

2 views (last 30 days)
bus14
bus14 on 2 May 2019
Commented: Torsten on 8 May 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 Comments
Torsten
Torsten on 8 May 2019
I did not write pk(k), but Pk which is
Pk = [pk(1);pk(2);pk(3);...;pk(200)]

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!