Constraints can be made active or inactive by the constraint_mode() method. By default all written constraints are in active mode and will be considered by the solver during randomization. When a constraint is made inactive, then it will not be considered in randomization. So, we can dynamically turn on and off a constraint based on the requirements.
The object is any expression that yields the object handle in which the constraint is defined and constraint_identifier is the name of the constraint block to which the operation is applied. When called as a task, the argument passed to the task determine whether the specific constraint should be turned on/off. When called as a function, constraint_mode() returns the current state of the specified constraint.