linprog optimization of two functions
Mostra commenti meno recenti
Hi community,
I am trying to minimize a two stage function in which first value is computed on the bases of X & D and this values is thereafter used in a new minimization function. I think I almost have the correct code, but some errors keep popping up. or should I solve these functions in 2 seperate scripts?Does anyone know how to solve them?
%overall objective function = Min c.'*x+E[Q(x,D)]
%set of parameters
i=1
j=1
c = 3; %s<c
l = 0.25;
q = 6;
s = 1;
A1 = 1;
D= 60;
%d = 65; not used in estimation
x= D.'*A1;
%E[Q(x,D)= (l-q).'*z-s.'
%Q(x,D)=(l-q).'*z(*)-s.'*y(*);
%s.t x=y(*)+A1.'*z(*);
%to find value for E[Q(x,D)]
f2 = [-s.',(l-q).']; %[ Y, Z]
E=sum(f2)%
Aeq = [eye(j),A1.'];
beq = x;
lb = [zeros(1,i+j)];
ub = [inf(1,j), D(1)];
sol = linprog(f2,[],[],Aeq,beq,lb,ub);
y = sol(1);
z = sol(2) ;
%Now objective function is to minimize c.'*x+E
f1= [c.'+E];%or f1=[c.',E] how to define E in the f1 function? outcome of linprog f1 should give a value of x
Aeq = [];%no equality or inequality constraints, only requirement is for x>0, or should constraint of f2 also be added??
beq = [];
lb = [0];%x>0
ub = [Inf];
sol = linprog(f1,[],[],Aeq,beq,lb,ub);
x = sol(1)
I get no solution for x as matlab says the code is unbouded. However, my only constraint for f1 is that x>0, for f2 there is a constraint (x=y+A1.'*z)
hope that anyone knows what I am doing wrong.
Thankyou!
4 Commenti
Torsten
il 29 Apr 2019
f1 is negative. Thus x=+Inf minimizes f1.
By the way: min: c'*x and min: c'+x+E have the same vector x as solution.
bus14
il 29 Apr 2019
bus14
il 29 Apr 2019
Matt J
il 29 Apr 2019
We cannot tell you what the problem should be. Only the solution. There is nothing incorrect about the solution you have obtained, given the problem you've provided.
Risposte (0)
Categorie
Scopri di più su Solver Outputs and Iterative Display in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!