Good Morning. I have a problem with a mpvars. I have setted a mpvars with "is_binary" but in the solution this var is setted with a real number. Why?

Code:

z := (sum(i in n) s(i)*p(i)) - (sum(i in n)sum(j in n) c(i,j)*x(i,j))

sum(i in n) s(i)*q(i) <= m

forall(i in n) (sum(j in n) x(i,j)) - s(i) = 0

forall(j in n) (sum(i in n) x(i,j)) - s(j) = 0

forall(i in n) forall(j in 2..N) y(j)-y(i)+N*(1-x(i,j)) >= 1

forall(i in n) y(i) is_integer

y(1) = 1

forall(i in 2..N) y(i) >= 2

forall(i in 2..N) y(i) <= N

forall(i in n) s(i) is_binary

s(1) = 1

forall(i,j in n) x(i,j) is_binary

forall(i in n) x(i,i) = 0

maximize(z)

a lot of item of Matrix x is setted with real number (ex. -2.3626e-010)

Any discrete variables in a MIP solution take integer values within a tolerance range that is defined by the parameter XPRS_MIPTOL (with a default value of 1e-6).

In your solution reporting, you could apply rounding to solution values of discrete variables to obtain integer values, such as

forall(i in n) writeln( round(s(i).sol) )

You can try to achieve higher accuracy, albeit typically at the expense of longer computing times, by reducing this tolerance value - e.g., setparam("XPRS_MIPTOL", 1e-7) - please notice that this tolerance needs to be slightly larger than the feasibility tolerance XPRS_FEASTOL, so the latter should be redefined accordingly - e.g. setparam("XPRS_FEASTOL", 1e-8) , preferrably not smaller than 1e-9.

Alternatively, you could try to employ the solution refiner to either either reduce LP infeasibility or improve MIP feasibility - however, this functionality does not guarantee to return exact integer values either:

declarations

mysol, refined:mpsol

end-declarations

savesol(mysol)

refined:= refinemipsol(mysol)