It seems that Integer Programs solved with CPLEX sometimes have the wrong
bounds on binary variables.  For instance,

p=MixedIntegerLinearProgram(solver="CPLEX")
x=p.new_variable(dim=1)  #,binary=True)
p.add_constraint(x[0]+x[1]==2)
p.set_objective(None)
p.set_binary(x)
p.show()
p.solve()
print p.get_values(x)

gives the output

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

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to