MCS (cpmpy.tools.explain.mcs)
- cpmpy.tools.explain.mcs.mcs(soft, hard=[], solver='ortools', time_limit=None)[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
- Parameters:
time_limit – time limit in seconds (default: None)
- Returns:
list of constraints, or empty list if time limit is reached
- cpmpy.tools.explain.mcs.mcs_grow(soft, hard, solver='ortools', time_limit=None)[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
- Parameters:
time_limit – time limit in seconds (default: None)
- Returns:
list of constraints, or empty list if time limit is reached
- cpmpy.tools.explain.mcs.mcs_grow_naive(soft, hard, solver='ortools', time_limit=None)[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
- Parameters:
time_limit – time limit in seconds (default: None)
- Returns:
list of constraints, or empty list if time limit is reached
- cpmpy.tools.explain.mcs.mcs_opt(soft, hard, weights=1, solver='ortools', time_limit=None)[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.
- Parameters:
time_limit – time limit in seconds (default: None)
- Returns:
list of constraints, or empty list if time limit is reached