I am working on the Electric Vehicle Routing problem and the solution to my problem is infeasible. Now, How can I get the constraints due to which the solution is infeasible? I want to get the violated constraints in docplex using Python API.
solve_status = mdl.get_solve_status()
if solve_status.name == 'INFEASIBLE_SOLUTION': # or also 'INFEASIBLE_OR_UNBOUNDED_SOLUTION'
cref = cr.ConflictRefiner()
print('show some of the constraints that can be removed to arrive at a minimal conflict')
cref.refine_conflict(mdl, display=True)
I tried this, but this gives me number of constraint which are violating. Not print the constraints.
In the docplex documentation, there are fonctions to display conflicts and iterate over them : https://ibmdecisionoptimization.github.io/docplex-doc/mp/docplex.mp.conflict_refiner.html These are
docplex.mp.conflict_refiner.dislay()- Displays all conflicts.docplex.mp.conflict_refiner.iter_conflicts()- Returns an iterator on conflicts (named tuples).