concepts.dsl.constraint.Constraint#

class Constraint[source]#

Bases: object

A constraint is basically a equality expression: function(*arguments) == rv.

Methods

constraint_str()

Return the string representation of the constraint.

from_function(function, args, rv)

Create a constraint given a function, arguments, and return value.

replace_constants(assignments)

set_group(group)

Set the group of the constraint.

Attributes

EQUAL

Magic name for equality constraints.

is_equal_constraint

Check if the constraint is an equality constraint.

is_group_constraint

Return True if the constraint is a group constraint.

is_in_group

Check if the constraint is in a group.

function

either a string (currently only for equality constraints), or a BoolOpType or QuantificationOpType (for Boolean expressions), or a Function object.

arguments

The arguments to the function.

rv

The expected return value of the function.

note

An optional note for the constraint.

group

The group of the constraint.

__init__(function, arguments, rv, note=None, group=None)[source]#

Initialize a constraint. Each constraint takes the form of:

function(*arguments) == rv
Parameters:
__new__(**kwargs)#
constraint_str()[source]#

Return the string representation of the constraint.

classmethod from_function(function, args, rv)[source]#

Create a constraint given a function, arguments, and return value.

Parameters:
Returns:

The created constraint.

Return type:

Constraint

replace_constants(assignments)[source]#
Parameters:

assignments (Dict[int, TensorValue]) –

Return type:

Constraint

set_group(group)[source]#

Set the group of the constraint.

Parameters:

group (GroupConstraint) –

EQUAL = '__EQ__'#

Magic name for equality constraints.

arguments: Tuple[TensorValue | OptimisticValue, ...]#

The arguments to the function.

function: str | BoolOpType | QuantificationOpType | Function | SimulationFluentConstraintFunction#

either a string (currently only for equality constraints), or a BoolOpType or QuantificationOpType (for Boolean expressions), or a Function object.

Type:

The function identifier

group: GroupConstraint | None#

The group of the constraint. None if the constraint is not in a group.

property is_equal_constraint: bool#

Check if the constraint is an equality constraint.

property is_group_constraint: bool#

Return True if the constraint is a group constraint.

property is_in_group: bool#

Check if the constraint is in a group.

note: Any#

An optional note for the constraint.

rv: TensorValue | OptimisticValue#

The expected return value of the function.