Intlinprog does not retun integer solution

I'se setup a problem for intlinprog, solutions are constrained to be binary:
lb =
0 0 0 0 0 0 0 0 0
ub =
1 1 1 1 1 1 1 1 1
However this is what I get when I run intlingprog:
LP: Optimal objective value is 6.000000.
Optimal solution found.
Intlinprog stopped at the root node because the objective value is within a gap tolerance of the optimal value,
options.TolGapAbs = 0 (the default value). The intcon variables are integer within tolerance,
options.TolInteger = 1e-05 (the default value).
ans =
0.5000 0.5000 0 0 0.5000 0.5000 0 0 0
Which is clearly a not integer solution within the tollerance.
What am I missing?

댓글 수: 1

Matt J
Matt J 2015년 4월 5일
편집: Matt J 2015년 4월 5일
How about we see the code that produced it?

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

 채택된 답변

Bo Li
Bo Li 2015년 5월 2일

1 개 추천

Yes, the INTCON parameter is very important to constrain the value of the variables to be integer. It does NOT mean the number of integer, but means the integer constraints. I made the same mistake.
See what it is explained:
intcon — Vector of integer constraints vector of integers Vector of integer constraints, specified as a vector of positive integers. The values in intcon indicate the components of the decision variable x that are integer-valued. intcon has values from 1 through numel(f).
intcon can also be an array. Internally, intlinprog converts an array intcon to the vector intcon(:).
Example: intcon = [1,2,7] means x(1), x(2), and x(7) take only integer values.

댓글 수: 1

Roberto
Roberto 2015년 5월 2일
Thanks, should have read the documentation with more attention.

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

추가 답변 (1개)

Alan Weiss
Alan Weiss 2015년 4월 6일

1 개 추천

Without seeing your intlinprog call, I can only guess that you neglected to include an intcon vector of the requisite length.
Alan Weiss
MATLAB mathematical toolbox documentation

댓글 수: 2

This is the entire problem:
f =
3 3 3 3 3 3 0 0 3 3 0 0 3 3 3 3 3 3
intcon =
18
A =
2 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 2 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 2 2 0 0 0 0 0 0 0 0 0 0 0 0
1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 2 2 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 2 2 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 2 2 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 2 2 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2
b =
10 10 0 1 1 1 0 100 0 100 100 100
Aeq =
1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0
0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0
1 -1 0 0 0 0 0 0 -1 0 0 0 0 0 1 0 0 0
-1 1 0 0 0 0 0 0 0 -1 0 0 0 0 0 1 0 0
0 0 1 -1 0 0 0 0 0 0 0 0 -1 0 0 0 1 0
0 0 -1 1 0 0 0 0 0 0 0 0 0 -1 0 0 0 1
0 0 0 0 1 -1 0 0 1 0 0 0 1 0 -1 0 -1 0
0 0 0 0 -1 1 0 0 0 1 0 0 0 1 0 -1 0 -1
beq =
1 1 0 0 0 0 0 0
lb =
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
ub =
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
and this is the output of
intlinprog(f,intcon,A,b,Aeq,beq,lb,ub);
LP: Optimal objective value is 6.000000.
Optimal solution found.
Intlinprog stopped at the root node because the objective value is within a gap tolerance of the optimal value, options.TolGapAbs = 0 (the default value). The intcon variables are
integer within tolerance, options.TolInteger = 1e-05 (the default value).
ans =
0.5000 0.5000 0.5000 0.5000 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Matt J
Matt J 2015년 4월 12일
편집: Matt J 2015년 4월 12일
As Alan guessed, you are interpreting intcon incorrectly. Setting intcon=18 means that you are requiring only x(18) to be integer-valued. You should really have
intcon=1:18;

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

카테고리

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

태그

질문:

2015년 4월 5일

댓글:

2015년 5월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by