Skip to content

Instantly share code, notes, and snippets.

@syxolk
Created August 21, 2019 11:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save syxolk/63e2f5d60d971d55676c99059ca04ede to your computer and use it in GitHub Desktop.
Save syxolk/63e2f5d60d971d55676c99059ca04ede to your computer and use it in GitHub Desktop.
CPLEX logical_and does not work
from docplex.mp.model import Model
m = Model("test")
a = m.binary_var(name="a")
b = m.binary_var(name="b")
c = m.binary_var(name="c")
m.add_constraint(m.logical_and(a, b) == c)
m.add_constraint(a == 1)
m.add_constraint(b == 0)
if m.solve():
m.print_solution(print_zeros=True)
else:
print(m.solve_details)
@syxolk
Copy link
Author

syxolk commented Aug 21, 2019

Outputs:

status  = integer infeasible
time    = 0.0016582 s.
problem = MILP

@PhilippeCouronne
Copy link

I'm afraid you have indeed hit on a bug in docplex (I have filed a bug report).
More information (and a workaround) can be found in IBM developerworks:
https://www.ibm.com/developerworks/community/forums/html/topic?id=b8ca2821-3f08-4cf2-a4c7-55253f5265fe
This bug will be fixed in the next release.
Philippe Couronne, IBM

@Phibedy
Copy link

Phibedy commented Aug 23, 2019

@PhilippeCouronne
Is the python interface well tested? If not, we don't mind using another interface :)

@syxolk
Copy link
Author

syxolk commented Aug 30, 2019

This is fixed in version 2.10.155 as of Aug 27, 2019. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment