Maximization: Constraints: 2.0 <= x_0 + x_1 <= 2.0 Variables: x_0 is a boolean variable (min=0.0, max=+oo) x_1 is a boolean variable (min=0.0, max=+oo) {0: 2.0, 1: 0.0}Note that x[0] has the solution 2, which shouldn't happen for a binary variable. In the output, the upper bound of the variable is not printed correctly, but I'm not sure if that's a problem, since an upper bound should not need to be explicitly set for a binary variable. In other instances when using binary variables with CPLEX, they seem to behave as they should.This issue is more problematic than it appears, since if CPLEX is installed it becomes the default IP/LP solver, and other things can randomly fail. For instance,sage.combinat.integer_vector.gale_ryser_theorem([2]*5,[5]*2)should give a 5x2 matrix of all 1's but instead gives[2 0] [2 0] [1 1] [0 2] [0 2]I am using Sage 5.12 and IBM ILOG CPLEX 12.5.1.0. I took a look in cplex_backend.pyx, but nothing immediately jumped out as a problem.Thanks for any insight that anyone has!Best wishes,Stephen
It seems that Integer Programs solved with CPLEX sometimes have the wrong bounds on binary variables. For instance,
{0: 2.0, 1: 0.0}Note that x[0] has the solution 2, which shouldn't happen for a binary variable.
In the output, the upper bound of the variable is not printed correctly, but I'm not sure if that's a problem, since an upper bound should not need to be explicitly set for a binary variable.
In other instances when using binary variables with CPLEX, they seem to behave as they should.This issue is more problematic than it appears, since if CPLEX is installed it becomes the default IP/LP solver, and other things can randomly fail. For instance,sage.combinat.integer_vector.gale_ryser_theorem([2]*5,[5]*2)should give a 5x2 matrix of all 1's but instead gives[2 0] [2 0] [1 1] [0 2] [0 2]I am using Sage 5.12 and IBM ILOG CPLEX 12.5.1.0. I took a look in cplex_backend.pyx, but nothing immediately jumped out as a problem.
Thanks for any insight that anyone has!
{0: 2.0, 1: 0.0}Note that x[0] has the solution 2, which shouldn't happen for a binary variable.When I ran the example of code you gave (removing the comment before binary=True, I get the solution 0:1, 1:1, which is good. If you really get a variable equal to 2 on this example, something is dead wrong indeed.
Well, I would be glad to help but I would need to be able to reproduce one of the bugs for a start :-P
> Something is indeed wrong, and I have experienced similar problems in the past. What version of CPLEX and which version of Sage are you using? I am using IBM ILOG CPLEX 12.5.1.0, and Sage 5.12 on Fedora Linux 19 and Sage 5.10 on Fedora 13.
HMmmmm... Well, to be honest I don't know. The truth is : I don't remember having met a nasty bug like that with Sage at any point, though it is possible that it may have been fixed since since you do not use the latest version of Sage.. Coud you try it with a more recent version of Sage, like the 6.0 ?
Actually, there is a trac ticket waiting for review related to how LP solvers handle bounds, but I do not think it is related to this bug
http://trac.sagemath.org/ticket/15622(it does *not only* fix GLPK code)