I'm using docplex to build up a mixed integer program which is then solved via cplex. However, upon trying to solve the MIP I receive the following error:
CPLEX> read plan.lp
CPLEX Error 1434: Line 184224: Couldn't convert '1<->' to a number.
No file read.
Looking at the lp file, the following line can be seen to be the problem:
1 <->
M13790
+ M13791
>= 1
And the line which creates the constraint is:
ilp.add_if_then(
ilp.sum([x.select_var for x in self.allX]) >= 1,
self.select_var == 1,
)
Where ilp is the docplex.mp.model object and each select_var is a binary decision variable. I'm really unsure of why this may be happening, and I'd appreciate any help with it!
Logical constraints (such as add_if_then) require a CPLEX 12.8 runtime to solve. If you run DOcplex with an older version of CPLEX in you PYTHONPATH, then an error should be raised.
If CPLEX is not found in PYTHONPATH, then DOcplex has no way to guess which version you'll be using (you might want to submit a Python job to DOcplexcloud, in which case your model will be solved with a CPLEX 12.8 runtime)
The generated LP file contains logical equivalence syntax (<->) which may not be read by older versions of CPLEX. Again, the best way to solve such LPs is to use a CPLEX 12.8 either by upgrading your local library or going to the cloud.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With