필터 지우기
필터 지우기

linprog

조회 수: 5 (최근 30일)
Nina
Nina 2011년 9월 13일
편집: Aurele Turnes 2017년 11월 13일
Dear all, I am dealing with linprog function and have some difficulties with it. The function I need to optimize is: f=1.44-0.05x-0.04y, subject to x>=0, y>=0, y>= -x +10, y<=-x+12 , y<=(1/3)x.
Where do I include the constant value from the objective function 1.44?
Thanks a lot.
Nina

답변 (3개)

Andrei Bobrov
Andrei Bobrov 2011년 9월 13일
Removed first variant (17:20 MDT[09:20 EDT])
Hi Nina! Adjustment for the right answer (ADD 13.09.2011 14:20 MDT [06:20EDT])
f = [ 0.05; 0.04];
A = [-1 -1; 1 1];
b = [-10; 12;];
Aeq = [-1/3 1];
beq = 0;
lb = [0; 0;];
[x,fval,exitflag,output,lambda] = linprog(f,A,b,Aeq,beq,lb)
ADD2 13.09.2011 (14:25 MDT [06:25EDT])
f = [ 0.05; 0.04;];
A = [-1 -1 ; 1 1 ; -1/3 1];
b = [-10; 12; 0];
lb = [0; 0;];
[x,fval,exitflag,output,lambda] = linprog(f,A,b,[],[],lb)

Nina
Nina 2011년 9월 13일
Thanks Andrei, but it's wrong :(
The right solution should be 7.5 for x and 2.5 for y.
Why do you put the whole equation on the left side (in matrix A) and don't leavi it for b?

Aurele Turnes
Aurele Turnes 2017년 11월 13일
편집: Aurele Turnes 2017년 11월 13일
If you have R2017b, you can use the new problem-base approach. It will take care of the constant value for you: https://www.mathworks.com/help/optim/problem-based-lp-milp.html

카테고리

Help CenterFile Exchange에서 Problem-Based Optimization Setup에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by