ams.core.param.RParam#

class ams.core.param.RParam(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, v: ndarray | None = None, indexer: str | None = None, imodel: str | None = None, expand_dims: int | None = None, no_parse: bool | None = False, nonneg: bool | None = False, nonpos: bool | None = False, cplx: bool | None = False, imag: bool | None = False, symmetric: bool | None = False, diag: bool | None = False, hermitian: bool | None = False, boolean: bool | None = False, integer: bool | None = False, pos: bool | None = False, neg: bool | None = False, sparse: list | None = None)[source]#

Class for parameters used in a routine. This class is developed to simplify the routine definition.

RParm is further used to define Parameter in the optimization model.

no_parse is used to skip parsing the RParam in optimization model. It means that the RParam will not be added to the optimization model. This is useful when the RParam contains non-numeric values, or it is not necessary to be added to the optimization model.

Parameters:
namestr, optional

Name of this parameter. If not provided, name will be set to the attribute name.

tex_namestr, optional

LaTeX-formatted parameter name. If not provided, tex_name will be assigned the same as name.

infostr, optional

A description of this parameter

srcstr, optional

Source name of the parameter.

unitstr, optional

Unit of the parameter.

modelstr, optional

Name of the owner model or group.

vnp.ndarray, optional

External value of the parameter.

indexerstr, optional

Indexer of the parameter.

imodelstr, optional

Name of the owner model or group of the indexer.

no_parse: bool, optional

True to skip parsing the parameter.

nonneg: bool, optional

True to set the parameter as non-negative.

nonpos: bool, optional

True to set the parameter as non-positive.

cplx: bool, optional

True to set the parameter as complex.

imag: bool, optional

True to set the parameter as imaginary.

symmetric: bool, optional

True to set the parameter as symmetric.

diag: bool, optional

True to set the parameter as diagonal.

hermitian: bool, optional

True to set the parameter as hermitian.

boolean: bool, optional

True to set the parameter as boolean.

integer: bool, optional

True to set the parameter as integer.

pos: bool, optional

True to set the parameter as positive.

neg: bool, optional

True to set the parameter as negative.

sparse: bool, optional

True to set the parameter as sparse.

Examples

Example 1: Define a routine parameter from a source model or group.

In this example, we define the parameter cru from the source model SFRCost with the parameter cru.

>>> self.cru = RParam(info='RegUp reserve coefficient',
>>>                   tex_name=r'c_{r,u}',
>>>                   unit=r'$/(p.u.)',
>>>                   name='cru',
>>>                   src='cru',
>>>                   model='SFRCost'
>>>                   )

Example 2: Define a routine parameter with a user-defined value.

In this example, we define the parameter with a user-defined value. TODO: Add example

__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, v: ndarray | None = None, indexer: str | None = None, imodel: str | None = None, expand_dims: int | None = None, no_parse: bool | None = False, nonneg: bool | None = False, nonpos: bool | None = False, cplx: bool | None = False, imag: bool | None = False, symmetric: bool | None = False, diag: bool | None = False, hermitian: bool | None = False, boolean: bool | None = False, integer: bool | None = False, pos: bool | None = False, neg: bool | None = False, sparse: list | None = None)[source]#

Methods

get_idx()

Get the index of the parameter.

parse()

Parse the parameter.

update()

Update the Parameter value.

Attributes

class_name

Return the class name

dtype

Return the data type of the parameter value.

n

Return the szie of the parameter.

shape

Return the shape of the parameter.

size

Return the size.

v

The value of the parameter.