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 个评论
采纳的回答
更多回答(1 个)
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 个评论
Roberto
2015-4-11
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 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!