When I create an mp model in docplex I can check whether or not a solution is feasible and can show the unsatisfied constraints for infeasible solutions:
from docplex.cp.model import CpoModel
from docplex.mp.model import Model
mp_model = Model('MP')
mp_x = mp_model.integer_var(0, 10, "x")
mp_model.add_constraint(mp_x <= 5)
mp_model.add_constraint(mp_x <= 2)
possible_mp_solution = mp_model.new_solution()
possible_mp_solution.add_var_value(mp_x,3)
print(possible_mp_solution.find_unsatisfied_constraints(mp_model))
Is the same (or something similar) possible for CP? I know you can create solutions to use the as starting point, but i am searching for a way to get information on a possible solution.
cp_model = CpoModel(name='CP')
cp_x = cp_model.integer_var(0, 10, "x")
cp_model.add_constraint(cp_x <= 5)
cp_model.add_constraint(cp_x <= 2)
possible_cp_solution = cp_model.create_empty_solution()
possible_cp_solution.set_value(cp_x,3)
# does not exist
# print(possible_cp_solution.find_unsatisfied_constraints(cp_model))