maximization problem , linprog optimization

답변 (1개)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2023년 3월 26일

1 개 추천

Here is a nice documentation showing several examples how to apply linprog() fcn of MATLAB to solve such exercises:

댓글 수: 6

Matt J
Matt J 2023년 3월 26일
Also, you could use a problem-based workflow,
I tried this one and it was not optimised well.
A=[0 -0.0123 0.738;0.0069 0.0069 0.828];
b=[-0.123;2.001];
lb=[160;10;0];
ub=[220;70; ];
f=[0;0;-1];
Aeq = [];
beq = [];
[x,favl]=linprog(f,A,b,Aeq,beq,lb,ub);
Warning: Length of upper bounds is < length(x); filling in missing upper bounds with +Inf.
Optimal solution found.
f1=0*x(1)+0.0123*x(2);
f2=-0.0069*x(1)-0.0069*x(2);
Matt J
Matt J 2023년 3월 27일
Why do you think anything is wrong, apart from the warning?
xu
xu 2023년 3월 27일
Since the optimal solution obtained from the literature was rather different from the one I got, I wondered if there was something wrong with my code.
You should have,
ub=[220;70; +inf];
but that won't make a difference to the result.
You can double check things with the problem-based approach:
lam=optimvar('lambda',1,'Lower',0);
x=optimvar('x',[2,1],'Lower',[160,10],'Upper',[220,70]);
Con.Con1=0.0123*x(2)-0.738*lam>=0.123;
Con.Con2=-0.0069*sum(x)-0.828*lam>=-2.001;
prob=optimproblem('Objective',lam,'ObjectiveSense','max','Constraints',Con);
sol=solve(prob)
Solving problem using linprog. Optimal solution found.
sol = struct with fields:
lambda: 0.6667 x: [2×1 double]

댓글을 달려면 로그인하십시오.

카테고리

질문:

xu
2023년 3월 26일

댓글:

2023년 3월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by