I am currently trying to use the CPLEX Solver with PULP. The model I have defined with PULP works with the XPRESS solver, but I am having difficulties with using CPLEX.
When I run (in a jupyter notebook):
path_to_cplex = '/Applications/CPLEX_Studio_Community2211/cplex/bin/x86-64_osx/cplex'
solver = CPLEX_CMD(path=path_to_cplex, msg=True)
prob.solve(solver=solver)
I get:
Welcome to IBM(R) ILOG(R) CPLEX(R) Interactive Optimizer Community Edition 22.1.1.0
with Simplex, Mixed Integer & Barrier Optimizers
5725-A06 5725-A29 5724-Y48 5724-Y49 5724-Y54 5724-Y55 5655-Y21
Copyright IBM Corp. 1988, 2022. All Rights Reserved.
Type 'help' for a list of available commands.
Type 'help' followed by a command name for more
information on commands.
CPLEX> CPLEX Error 1608: Line 6: Expected '+','-' or sense, found ':'.No file read.
My question is how do I see what line (in this case line 6) CPLEX is referring to? I tried reading the PULP and CPLEX documentation but I couldn't find anything too helpful.
Posting this in case someone else was searching for this.
In order to see the .lp file that CPLEX is referring to, you need to pass keepFiles=True
when setting the solver. i.e.
solver = CPLEX_CMD(keepFiles=True)
prob.solve(solver=solver)
Then the .lp file should appear in the current directory under the name '{model_name_in_pulp}-pulp.lp'.