linprog optimization of two functions

4 ビュー (過去 30 日間)
bus14
bus14 2019 年 4 月 29 日
コメント済み: Matt J 2019 年 4 月 29 日
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 件のコメント
bus14
bus14 2019 年 4 月 29 日
problem for me is, if the f1 was set correctly and how I can find a satisfactory value for x which is larger than zero and as upperbound is not much higher than the value of D
Matt J
Matt J 2019 年 4 月 29 日
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.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeSolver Outputs and Iterative Display についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by