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:
IVariableA 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
RealSetorIntegerSet. Can be updated later by assigning to thedomain_typeproperty. The default value ofNoneis equivalent toRealSet, unless thedomainkeyword is used. - domain – Sets the domain of the variable. This
updates the
domain_type,lb, andubproperties of the variable. The default value ofNoneimplies that this keyword is ignored. This keyword can not be used in combination with thedomain_typekeyword. - lb – Sets the lower bound of the variable. Can be
updated later by assigning to the
lbproperty 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
ubproperty 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
valueproperty on the variable. Default isNone. - fixed (bool) – Sets the fixed status of the
variable. Can be updated later by assigning to
the
fixedproperty 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_typeproperty and overwrites thelbandubproperties with the domain bounds.
-
property
domain_type The domain type of the variable (
RealSetorIntegerSet)
-
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:
TupleContainerA tuple-style container for objects with category type IVariable
-
class
pyomo.core.kernel.variable.variable_list(*args, **kwds) Bases:
ListContainerA list-style container for objects with category type IVariable
-
class
pyomo.core.kernel.variable.variable_dict(*args, **kwds) Bases:
DictContainerA dict-style container for objects with category type IVariable