cpmpy.model.Model
- class cpmpy.model.Model(*args, minimize=None, maximize=None)[source]
CPMpy Model object, contains the constraint and objective expressions
- __init__(*args, minimize=None, maximize=None)[source]
Arguments of constructor:
- Parameters:
*args – Expression object(s) or list(s) of Expression objects
minimize – Expression object representing the objective to minimize
maximize – Expression object representing the objective to maximize
At most one of minimize/maximize can be set, if none are set, it is assumed to be a satisfaction problem
Methods
__init__(*args[, minimize, maximize])Arguments of constructor:
add(con)Add one or more constraints to the model.
copy()Makes a shallow copy of the model.
deepcopy([memodict])from_file(fname)Reads a Model instance from a binary pickled file
Check if the model has an objective function
maximize(expr)Maximize the given objective function
minimize(expr)Minimize the given objective function
objective(expr, minimize)Users will typically use
minimize()ormaximize()to set the objective function, this is the generic implementation for both.Returns the value of the objective function of the last solver run on this model
solve([solver, time_limit])Send the model to a solver and get the result.
solveAll([solver, display, time_limit, ...])Compute all solutions and optionally display the solutions.
status()Returns the status of the latest solver run on this model
to_file(fname)Serializes this model to a
.pickleformat