Get variables from expressions (cpmpy.transformations.get_variables)

Returns an list of all variables in the model or expressions

Variables are ordered by appearance, e.g. first encountered first

cpmpy.transformations.get_variables.get_variables(expr, collect=None)[source]

Get variables of an expression

  • expr: Expression or list of expressions

  • collect: optional set, variables will be added to this set of given

cpmpy.transformations.get_variables.get_variables_model(model)[source]

Get variables of a model (constraints and objective)

This is a separate function because we can not import Model without a circular dependency…

cpmpy.transformations.get_variables.print_variables(expr_or_model)[source]

Print variables _and their domains_

argument ‘expr_or_model’ can be an expression or a model

cpmpy.transformations.get_variables.vars_expr(expr)[source]