I use Docplex with python 3.7 to implement constraints programming. when it was infeasible, how can I proceed to list constraints those was to source of the conflict?
mdl.export_as_cpo(out="/home/..../MCP3.lp")
msol = mdl.solve(FailLimit=700000, TimeLimit=1600)
DInfos= msol.get_solver_infos()
mconflict=msol.CpoRefineConflictResult()
mconflict.get_all_member_constraints()
Error message: mconflict=msol.CpoRefineConflictResult() AttributeError: 'CpoSolveResult' object has no attribute 'CpoRefineConflictResult'
solve
returns a SolveResult
, and CpoRefineConflictResult
is a class in docplex.cp.solution
. So, the error message is correct: a SolveResult
does not have an attribute CpoRefineConflictResult
. You'd expect the CpoRefineConflictResult
as the result of the conflict refiner.
You should probably read through the documentation a bit more http://ibmdecisionoptimization.github.io/docplex-doc/cp/docplex.cp.solution.py.html
You can call the .refine_conflict()
method on the CpoSolver
object to obtain a CpoRefineConflictResult
, as documented here http://ibmdecisionoptimization.github.io/docplex-doc/cp/docplex.cp.solver.solver.py.html#detailed-description