ams.opt.expression.Expression#
- class ams.opt.expression.Expression(name: str | None = None, tex_name: str | None = None, info: str | None = None, unit: str | None = None, e_str: str | None = None, e_fn: Callable | None = None, model: str | None = None, src: str | None = None, vtype: str | None = <class 'float'>, horizon: str | None = None)[source]#
Base class for expressions used in a routine.
Routines are authored with
e_strstrings; the codegen atams.prep.generate_for_routine()compiles eache_strinto a callablee_fn(r)taking aRoutineNSproxy and returning a CVXPY expression. The mutex descriptor one_str/e_fnkeeps the two forms exclusive.- Parameters:
- namestr, optional
Expression name. One should typically assigning the name directly because it will be automatically assigned by the model. The value of
namewill be the symbol name to be used in expressions.- tex_namestr, optional
LaTeX-formatted variable symbol. Defaults to the value of
name.- infostr, optional
Descriptive information
- unitstr, optional
Unit
- e_strstr, optional
Expression string (legacy form).
- e_fncallable, optional
Callable
e_fn(r) -> cp.Expressiontaking aRoutineNS.- modelstr, optional
Name of the owner model or group.
- srcstr, optional
Source expression name
- vtypetype, optional
Value type
- horizonams.routines.RParam, optional
Horizon
- __init__(name: str | None = None, tex_name: str | None = None, info: str | None = None, unit: str | None = None, e_str: str | None = None, e_fn: Callable | None = None, model: str | None = None, src: str | None = None, vtype: str | None = <class 'float'>, horizon: str | None = None)[source]#
Methods
Attributes
Return the class name
Return the calculated numerical value of the underlying expression.
Mutex descriptor for
e_str/e_fnon opt elements.Mutex descriptor for
e_str/e_fnon opt elements.Where the live CVXPY object for this item came from.
Return the number of elements.
Return the shape.
Return the size.
Return the CVXPY expression value.