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
orIntegerSet
. Can be updated later by assigning to thedomain_type
property. The default value ofNone
is equivalent toRealSet
, unless thedomain
keyword is used. - domain – Sets the domain of the variable. This
updates the
domain_type
,lb
, andub
properties of the variable. The default value ofNone
implies that this keyword is ignored. This keyword can not be used in combination with thedomain_type
keyword. - lb – Sets the lower bound of the variable. Can be
updated later by assigning to the
lb
property on the variable. Default isNone
, 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 isNone
, 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 isNone
. - fixed (bool) – Sets the fixed status of the
variable. Can be updated later by assigning to
the
fixed
property or by calling thefix()
method. Default isFalse
.
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 thelb
andub
properties with the domain bounds.
-
property
domain_type
The domain type of the variable (
RealSet
orIntegerSet
)
-
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
- domain_type – Sets the domain type of the
variable. Must be one of
-
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