relentless.model.Constant#

class relentless.model.Constant(value, name=None)#

Constant value.

The value of a constant-value variable cannot be changed after it is initialized. This distinguishes it from the IndependentVariable.

Parameters:
  • value (float) – Constant value of the variable.

  • name (str) – Optional name for the variable. The name must be unique. If one is not specified, a mangled name __x[id] will be automatically created, where id is the unique index identifying the variable.

Examples

Create a constant variable:

>>> x = ConstantVariable(2.0)
>>> print(x.value)
2.0
>>> print(x.name)
'__x[0]'

Create a constant variable with a name:

>>> y = ConstantVariable(3.0, name='y')
>>> print(y.name)
'y'
Raises:

Methods

Attributes

count

names

value

Value of the variable.

property value#

Value of the variable.

Type:

float