PuLP issues with the CHOCO solver #521
Unanswered
ondrejiayc
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi all, I've been trying to test PuLP with a series of different solvers and am running into problems with CHOCO. Has anyone had much success with that? Am I using the wrong version of CHOCO perhaps?
My system: Ubuntu 20.04
Python: tried both 2.7 and 3.8 (same behaviour)
PuLP version: tried both 2.5 and 2.6
CHOCO version: 4.10.7 from here
Problem 1: PuLP does not correctly parse a solution to an "empty problem"
I tried running an "empty problem":
`
import pulp
if pulp.version == "2.5.0":
solver = pulp.PULP_CHOCO_CMD()
elif pulp.version == "2.6.0":
solver = pulp.CHOCO_CMD(path=path_to_choco_jar) # in pulp 2.6
problem = pulp.LpProblem()
problem.solve()
`
This falls over with
ValueError: could not convert string to float: FOUND
. The solver returns a file, which is read into the memory as a list like['\x1b[37mc Unimodular: false', '\x1b[0mOPTIMUM FOUND', '__dummy\t0.0', '']
, which thereadsol
method of the solver struggles to parse as it contains a lot of unexpected characters. I could update the pulp but I'm not sure whether this is a general case to base the fix on, and maybe a fix already exists.Problem 2: Real to int conversion fails inside the solver
(sorry in case this is a PuLP-unrelated issue) When trying to run a "non-empty" problem that includes real numbers, the solution halts. Specifically, trying to manually run the command as PuLP would (with increased verbosity), e.g.
java -cp "/home/onu/Downloads/choco-parsers-4.10.7-jar-with-dependencies.jar" org.chocosolver.parser.mps.ChocoMPS /tmp/3187bacdcde44eb78558e969db76e0a6-pulp.mps -max -lvl VERBOSE
, it hangs on what seems like casting floats as integers:c Unimodular: false Objective | Measures | Progress CurrentDomain BestBnd | Depth Decisions WrongDecs Restarts | SolCount Time | Exception in thread "Thread-1" java.lang.ClassCastException: class org.chocosolver.solver.variables.impl.RealVarImpl cannot be cast to class org.chocosolver.solver.variables.IntVar (org.chocosolver.solver.variables.impl.RealVarImpl and org.chocosolver.solver.variables.IntVar are in unnamed module of loader 'app') at org.chocosolver.solver.variables.impl.AbstractVariable.asIntVar(AbstractVariable.java:492) at org.chocosolver.solver.trace.VerboseSolving.bodyOpt(VerboseSolving.java:126) at org.chocosolver.solver.trace.VerboseSolving.body(VerboseSolving.java:101) at org.chocosolver.solver.trace.VerboseSolving.lambda$new$0(VerboseSolving.java:56) at java.base/java.lang.Thread.run(Thread.java:831)
It does not exit, just stops here. Has anyone encountered and, ideally, solved, as issue like this?
Thanks in advance and have a good one!
Beta Was this translation helpful? Give feedback.
All reactions