Variables

Summary

pyomo.core.kernel.variable.variable([...])

A decision variable

pyomo.core.kernel.variable.variable_tuple(...)

A tuple-style container for objects with category type IVariable

pyomo.core.kernel.variable.variable_list(...)

A list-style container for objects with category type IVariable

pyomo.core.kernel.variable.variable_dict(...)

A dict-style container for objects with category type IVariable

Member Documentation

class pyomo.core.kernel.variable.variable(domain_type=None, domain=None, lb=None, ub=None, value=None, fixed=False)[source]

Bases: IVariable

A decision variable

Decision variables are used in objectives and constraints to define an optimization problem.

Parameters:
  • domain_type – Sets the domain type of the variable. Must be one of RealSet or IntegerSet. Can be updated later by assigning to the domain_type property. The default value of None is equivalent to RealSet, unless the domain keyword is used.

  • domain – Sets the domain of the variable. This updates the domain_type, lb, and ub properties of the variable. The default value of None implies that this keyword is ignored. This keyword can not be used in combination with the domain_type keyword.

  • lb – Sets the lower bound of the variable. Can be updated later by assigning to the lb property on the variable. Default is None, which is equivalent to -inf.

  • ub – Sets the upper bound of the variable. Can be updated later by assigning to the ub property on the variable. Default is None, which is equivalent to +inf.

  • value – Sets the value of the variable. Can be updated later by assigning to the value property on the variable. Default is None.

  • fixed (bool) – Sets the fixed status of the variable. Can be updated later by assigning to the fixed property or by calling the fix() method. Default is False.

Examples

>>> import pyomo.kernel as pmo
>>> # A continuous variable with infinite bounds
>>> x = pmo.variable()
>>> # A binary variable
>>> x = pmo.variable(domain=pmo.Binary)
>>> # Also a binary variable
>>> x = pmo.variable(domain_type=pmo.IntegerSet, lb=0, ub=1)
property domain

Set the domain of the variable. This method updates the domain_type property and overwrites the lb and ub properties with the domain bounds.

property domain_type

The domain type of the variable (RealSet or IntegerSet)

property fixed

The fixed status of the variable

property lower

The lower bound of the variable

property stale

The stale status of the variable

property upper

The upper bound of the variable

property value

The value of the variable

class pyomo.core.kernel.variable.variable_tuple(*args, **kwds)

Bases: TupleContainer

A tuple-style container for objects with category type IVariable

class pyomo.core.kernel.variable.variable_list(*args, **kwds)

Bases: ListContainer

A list-style container for objects with category type IVariable

class pyomo.core.kernel.variable.variable_dict(*args, **kwds)

Bases: DictContainer

A dict-style container for objects with category type IVariable