ams.core.service.VarSelect#

class ams.core.service.VarSelect(u: Callable, indexer: str, gamma: str = None, name: str = None, tex_name: str = None, unit: str = None, info: str = None, vtype: Type = None, rfun: Callable = None, rargs: dict = None, array_out: bool = True, no_parse: bool = False, sparse: bool = False, **kwargs)[source]#

A numerical matrix to select a subset of a 2D variable, u.v[:, idx].

For example, if need to select Energy Storage output power from StaticGen pg, following definition can be used: `python class RTED: ... self.ce = VarSelect(u=self.pg, indexer='genE') ... `

Parameters:
uCallable

The input matrix variable.

indexer: str

The name of the indexer source.

gammastr, optional

The name of the indexer gamma.

namestr, optional

The name of the instance.

tex_namestr, optional

The TeX name for the instance.

unitstr, optional

The unit of the output.

infostr, optional

A description of the operation.

vtypeType, optional

The variable type.

rfunCallable, optional

Function to apply to the output of fun.

rargsdict, optional

Keyword arguments to pass to rfun.

array_outbool, optional

Whether to force the output to be an array.

no_parse: bool, optional

True to skip parsing the service.

sparse: bool, optional

True to return output as scipy csr_matrix.

__init__(u: Callable, indexer: str, gamma: str = None, name: str = None, tex_name: str = None, unit: str = None, info: str = None, vtype: Type = None, rfun: Callable = None, rargs: dict = None, array_out: bool = True, no_parse: bool = False, sparse: bool = False, **kwargs)[source]#

Methods

assign_memory(n)

Assign memory for self.v and set the array to zero.

evaluate(*args, **kwargs)

get_all_idxes()

Return all the indexes of this item.

get_idx()

get_names()

Return name in a list

parse(*args, **kwargs)

update()

Update the Parameter value.

Attributes

class_name

Return the class name

e

Return the calculated numerical value of the underlying expression.

formulation_source

Where the live CVXPY object for this item came from.

n

Return the count of values in self.v.

shape

Return the shape of the service.

size

Return the size.

v

Value of the service.

v0

v1