How to force intlinprog to give integer solution ?

The following command
x=intlinprog([0; 0; 0],[1 2 3],-[0 2 0;0 1 2;3 1 0],-[6;13;11],[],[],[0;0;0],[])
produced x=[2.6667 3 5]' which is not integer.

답변 (2개)

Matt J
Matt J 2015년 11월 7일
편집: Matt J 2015년 11월 7일

0 개 추천

I think it's a bug. If your goal is simply to find some feasible solution to the constraints, I think you can workaround the bug with any nonzero f vector, e.g.,
>> x=intlinprog([1e-10,0,0],[1 2 3],-[0 2 0;0 1 2;3 1 0],-[6;13;11],[],[],[0;0;0],[]);
x =
0
11
1

댓글 수: 3

Jan
Jan 2015년 11월 7일
편집: Walter Roberson 2015년 11월 7일
Thanks for the prompt answer, but try the following real optimization:
x=intlinprog([0; 1; 0],[1 2 3],-[0 2 0;0 1 2;3 1 0],-[6;13;11],[],[],[0;0;0],[]);
This gives x=[2.6667 3 5]'. Moreover, I have no idea how to find a proper f in a bigger problem.
What is the exitflag being returned? You do not appear to be recording the exitflag so you do not know what the output represents.
Jan
Jan 2015년 11월 8일
편집: Walter Roberson 2015년 11월 8일
Walter,
[x,y,exitflag,output]=intlinprog([0;1;0],[1 2 3],-[0 2 0;0 1 2;3 1 0],-[6;13;11],[],[],[0;0;0],[])
gives:
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).
x =
2.6667
3.0000
5.0000
y =
3
exitflag =
1
output =
relativegap: 0
absolutegap: 0
numfeaspoints: 1
numnodes: 0
constrviolation: 0
message: 'Optimal solution found.…'

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

Alan Weiss
Alan Weiss 2015년 11월 9일
편집: Alan Weiss 2015년 11월 9일

0 개 추천

I think that this must be a bug in your Optimization Toolbox™ version. Please report the issue to technical support. There might be a workaround.
Alan Weiss
MATLAB mathematical toolbox documentation

카테고리

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

질문:

Jan
2015년 11월 7일

편집:

2015년 11월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by