MCS (cpmpy.tools.explain.mcs)

cpmpy.tools.explain.mcs.mcs(soft, hard=[], solver='ortools')[source]

Compute Minimal Correction Subset of unsatisfiable model. Removing these contraints will result in a satisfiable model. Computes a subset of constraints which minimizes the total number of constraints to be removed

cpmpy.tools.explain.mcs.mcs_grow(soft, hard, solver='ortools')[source]

Computes correction subset without requirement of optimization support Relies on assumptions so incremental solvers are adviced. Can be faster in some cases compared to optimal correction subset

cpmpy.tools.explain.mcs.mcs_grow_naive(soft, hard, solver='ortools')[source]

Compute Minimal Correction Subset of unsatsifiable model. Computes a subset-minimal set of constraints by greedily removing contraints. Can be used when solver does not support assumptions No guarantees on optimality, but can be faster in some cases

cpmpy.tools.explain.mcs.mcs_opt(soft, hard, weights=1, solver='ortools')[source]

Compute Minimal Correction Subset of unsatisfiable model. Constraints can be weighted using the weights parameter. Computes a subset of constraints which minimizes the sum of all weights of constraints.