I am using matlab to solve a mixed integer programming, after I obtain a solution from linprog, I want to evaluate whether they are all integers(x is n dimensions), but I cannot figure out a way to do this.
All the functions, such as mod(x,1) == 0
, isequal(x,floor(x))
will give a wrong anwser.
More strange is, if you manually input a vector with the same parameter, it will turn out to be right.
The result is shown: (all the x here is obtained from the result of linprog). Anyone can help with this or bring out some other useful way to evaluate this?
K>> x
x =
7.0000
1.0000
K>> mod(x,1)
ans =
0.0000
1.0000
K>> x
x =
6.0000
3.0000
K>> isequal(x,floor(x))
ans =
0