Implements the Mutable base class for variables and parameters.


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

Bases: 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.

  • 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.


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.