Python builtin overwrites (cpmpy.expressions.python_builtins)

Overwrites a number of python built-ins, so that they work over variables as expected.

List of functions

all

all() overwrites python built-in, if iterable contains any Expression, then returns an Operator("and", iterable) otherwise returns whether all of the arguments are true

any

any() overwrites python built-in, if iterable contains an Expression, then returns an Operator("or", iterable) otherwise returns whether any of the arguments is true

max

max() overwrites the python built-in to support decision variables.

min

min() overwrites the python built-in to support decision variables.

sum

sum() overwrites the python built-in to support decision variables.

abs

abs() overwrites the python built-in to support decision variables.

cpmpy.expressions.python_builtins.abs(element)[source]

abs() overwrites the python built-in to support decision variables.

if the element given is not a CPMpy expression, the built-in is called else an Absolute functional global constraint is constructed.

cpmpy.expressions.python_builtins.all(iterable)[source]

all() overwrites python built-in, if iterable contains any Expression, then returns an Operator(“and”, iterable) otherwise returns whether all of the arguments are true

cpmpy.expressions.python_builtins.any(iterable)[source]

any() overwrites python built-in, if iterable contains an Expression, then returns an Operator(“or”, iterable) otherwise returns whether any of the arguments is true

cpmpy.expressions.python_builtins.max(*iterable, **kwargs)[source]

max() overwrites the python built-in to support decision variables.

if iterable does not contain CPMpy expressions, the built-in is called else a Maximum functional global constraint is constructed; no keyword arguments are supported in that case

cpmpy.expressions.python_builtins.min(*iterable, **kwargs)[source]

min() overwrites the python built-in to support decision variables.

if iterable does not contain CPMpy expressions, the built-in is called else a Minimum functional global constraint is constructed; no keyword arguments are supported in that case

cpmpy.expressions.python_builtins.sum(*iterable, **kwargs)[source]

sum() overwrites the python built-in to support decision variables.

if iterable does not contain CPMpy expressions, the built-in is called checks if all constants and uses built-in sum() in that case