ams.opt.omodel.Constraint#

class ams.opt.omodel.Constraint(name: str | None = None, e_str: str | None = None, info: str | None = None, is_eq: str | None = False)[source]#

Base class for constraints.

This class is used as a template for defining constraints. Each instance of this class represents a single constraint.

Parameters:
namestr, optional

A user-defined name for the constraint.

e_strstr, optional

A mathematical expression representing the constraint.

infostr, optional

Additional informational text about the constraint.

is_eqstr, optional

Flag indicating if the constraint is an equality constraint. False indicates an inequality constraint in the form of <= 0.

Attributes:
is_disabledbool

Flag indicating if the constraint is disabled, False by default.

rtnams.routines.Routine

The owner routine instance.

__init__(name: str | None = None, e_str: str | None = None, info: str | None = None, is_eq: str | None = False)[source]#

Methods

parse([no_code])

Parse the constraint.

Attributes

class_name

Return the class name

n

Return the number of elements.

shape

Return the shape.

size

Return the size.

v

Return the CVXPY constraint LHS value.

v2

Return the calculated constraint LHS value.