ams.opt.omodel.Var#

class ams.opt.omodel.Var(name: str | None = None, tex_name: str | None = None, info: str | None = None, src: str | None = None, unit: str | None = None, model: str | None = None, shape: tuple | int | None = None, v0: str | None = None, horizon=None, nonneg: bool | None = False, nonpos: bool | None = False, cplx: bool | None = False, imag: bool | None = False, symmetric: bool | None = False, diag: bool | None = False, psd: bool | None = False, nsd: bool | None = False, hermitian: bool | None = False, boolean: bool | None = False, integer: bool | None = False, pos: bool | None = False, neg: bool | None = False)[source]#

Base class for variables used in a routine.

When horizon is provided, the variable will be expanded to a matrix, where rows are indexed by the source variable index and columns are indexed by the horizon index.

Parameters:
infostr, optional

Descriptive information

unitstr, optional

Unit

tex_namestr

LaTeX-formatted variable symbol. Defaults to the value of name.

namestr, optional

Variable name. One should typically assigning the name directly because it will be automatically assigned by the model. The value of name will be the symbol name to be used in expressions.

srcstr, optional

Source variable name. Defaults to the value of name.

modelstr, optional

Name of the owner model or group.

horizonams.routines.RParam, optional

Horizon idx.

nonnegbool, optional

Non-negative variable

nonposbool, optional

Non-positive variable

cplxbool, optional

Complex variable

imagbool, optional

Imaginary variable

symmetricbool, optional

Symmetric variable

diagbool, optional

Diagonal variable

psdbool, optional

Positive semi-definite variable

nsdbool, optional

Negative semi-definite variable

hermitianbool, optional

Hermitian variable

booleanbool, optional

Boolean variable

integerbool, optional

Integer variable

posbool, optional

Positive variable

negbool, optional

Negative variable

Attributes:
anp.ndarray

Variable address.

_vnp.ndarray

Local-storage of the variable value.

rtnams.routines.Routine

The owner routine instance.

__init__(name: str | None = None, tex_name: str | None = None, info: str | None = None, src: str | None = None, unit: str | None = None, model: str | None = None, shape: tuple | int | None = None, v0: str | None = None, horizon=None, nonneg: bool | None = False, nonpos: bool | None = False, cplx: bool | None = False, imag: bool | None = False, symmetric: bool | None = False, diag: bool | None = False, psd: bool | None = False, nsd: bool | None = False, hermitian: bool | None = False, boolean: bool | None = False, integer: bool | None = False, pos: bool | None = False, neg: bool | None = False)[source]#

Methods

get_idx()

parse()

Parse the variable.

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 variable value.