Skip to content

Constraints

Constraints are special components that allow you to add custom Python code to modify the optimisation problem. They store code blocks that are executed when building the optimisation model, enabling advanced users to implement custom operational rules and limits beyond the standard component attributes.

TIP

For detailed information on writing custom constraints, see the Custom Constraints section with working examples.

Properties

Constraint components are stored in the components table with component_type='CONSTRAINT' and have the following attributes:

AttributeData TypeUnitDefaultRequiredStorage TypeDescription
constraint_codestringn/a(empty)YesstaticPython code block defining constraint logic
descriptionstringn/a(empty)NostaticHuman-readable description of the constraint
is_activebooleann/aTrueNostaticWhether constraint is active and should be applied
priorityintn/a0NostaticExecution priority (lower numbers execute first)

Access in Convexity

In the Convexity application, navigate to Tables → Constraints to view, add, edit, or activate/deactivate custom constraints.

Learn More

© Copyright 2025 Bayesian Energy