How to maximise the following:
(a*100)+(b*60)+(c*70)+(d*65)+(e*50)+(f*50)+(g*45)+(h*40)+(i*40)+(j*30)
with a constraint:
(a*61)+(b*28)+(c*33)+(d*30)+(e*25)+(f*17)+(g*25)+(h*12)+(i*16)+(j*10) is less than or equal 110.
knowing that a-j are either 0 or 1.
I tried to solve it using this code:
f = [100;60;70;65;50;50;45;40;40;30];
intcon = 10;
A = [61,28,33,30,25,17,25,12,16,10];
b = [110];
x = intlinprog(f,intcon,A,b)
but I got the following error:
>> tod308
Root LP problem is unbounded.
Intlinprog stopped because the root LP problem is unbounded.
x =
[]

답변 (1개)

Matt J
Matt J 2022년 5월 1일
편집: Matt J 2022년 5월 1일

0 개 추천

lb=zeros(size(f));
x = intlinprog(-f,1:10,A,b,[],[],lb,lb+1);

댓글 수: 2

Meme alcute
Meme alcute 2022년 5월 1일
I did what you told me and I got this in my commaned window:
LP: Optimal objective value is -278.571429.
Cut Generation: Applied 1 cover cut.
Lower bound is -275.000000.
Relative gap is 0.00%.
Optimal solution found.
Intlinprog stopped at the root node because the objective value is within a gap tolerance of the optimal value, options.AbsoluteGapTolerance = 0 (the default value). The intcon
variables are integer within tolerance, options.IntegerTolerance = 1e-05 (the default value).
However, I don't know what is the value for each A - j?
Matt J
Matt J 2022년 5월 1일
편집: Matt J 2022년 5월 1일
Aren't you getting any output from intlinprog (aside from the screen messages)?

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

카테고리

도움말 센터File Exchange에서 Linear Programming and Mixed-Integer Linear Programming에 대해 자세히 알아보기

제품

릴리스

R2018a

질문:

2022년 5월 1일

편집:

2022년 5월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by