picos.expressions.mutable

Implements the Mutable base class for variables and parameters.

Classes

class picos.expressions.mutable.Mutable(name, vectorization)[source]

Bases: abc.ABC

Primary base class for all variable and parameter types.

Mutables need to inherit this class with priority (first class listed) and the affine expression type that they represent without priority.

__init__(name, vectorization)[source]

Perform basic initialization for Mutable instances.

Parameters
  • name (str) – Name of the mutable. A leading “__” denotes a private mutable and is replaced by a sequence containing the mutable’s unique ID.

  • vectorization (BaseVectorization) – Vectorization format used to store the value.

abstract copy(new_name=None)[source]

Return an independent copy of the mutable.

Note that unlike constraints which keep their ID on copy, mutables are supposed to receive a new id.

id_at(index)[source]

Return the unique ID of a scalar entry, assigned at creation.

property dim

The mutable’s dimension on the real field.

This corresponds to the length of its vectorized value.

property id

The unique (starting) ID of the mutable, assigned at creation.

property internal_value

The internal (special vectorized) value of the mutable.

property long_string[source]

A string used to represent the mutable in a problem string.

property name

The name of the mutable.