Normalize (cpmpy.transformations.normalize)

Normalizing the constraints given to a CPMpy model.

cpmpy.transformations.normalize.simplify_boolean(lst_of_expr, num_context=False)[source]

removes boolean constants from all CPMpy expressions only resulting boolean constant is literal ‘false’

Parameters:

list_of_expr – list of CPMpy expressions

cpmpy.transformations.normalize.toplevel_list(cpm_expr, merge_and=True)[source]

unravels nested lists and top-level AND’s and ensures every element returned is a CPMpy Expression with is_bool() true.

Parameters:
  • cpm_expr – Expression or list of Expressions

  • merge_and – if True then a toplevel ‘and’ will have its arguments merged at top level