# AML Library Reference¶

The following modeling components make up the core of the Pyomo Algebraic Modeling Language (AML). These classes are all available through the pyomo.environ namespace.

 ConcreteModel(*args, **kwds) A concrete optimization model that does not defer construction of components. AbstractModel(*args, **kwds) An abstract optimization model that defers construction of components. Block(*args, **kwargs) Blocks are indexed components that contain other components (including blocks). Set(*args, **kwds) A component used to index other Pyomo components. RangeSet(*args, **kwds) A set object that represents a set of numeric values Param(*args, **kwd) A parameter value, which may be defined over an index. Var(*args, **kwd) A numeric variable, which may be defined over an index. Objective(*args, **kwargs) This modeling component defines an objective expression. Constraint(*args, **kwargs) This modeling component defines a constraint expression using a rule function. Reference(reference[, ctype]) Creates a component that references other components

## AML Component Documentation¶

class pyomo.environ.ConcreteModel(*args, **kwds)[source]

Bases: pyomo.core.base.PyomoModel.Model

A concrete optimization model that does not defer construction of components.

activate()

Set the active attribute to True

active

Return the active attribute

active_blocks(*args, **kwargs)

DEPRECATION WARNING: The active_blocks method is deprecated. Use the Block.block_data_objects() method. (deprecated in 4.1.10486)

active_component_data(*args, **kwargs)

DEPRECATION WARNING: The active_component_data method is deprecated. Use the Block.component_data_objects() method. (deprecated in 4.1.10486)

active_components(*args, **kwargs)

DEPRECATION WARNING: The active_components method is deprecated. Use the Block.component_objects() method. (deprecated in 4.1.10486)

add_component(name, val)

Add a component ‘name’ to the block.

This method assumes that the attribute is not in the model.

all_blocks(*args, **kwargs)

DEPRECATION WARNING: The all_blocks method is deprecated. Use the Block.block_data_objects() method. (deprecated in 4.1.10486)

all_component_data(*args, **kwargs)

DEPRECATION WARNING: The all_component_data method is deprecated. Use the Block.component_data_objects() method. (deprecated in 4.1.10486)

all_components(*args, **kwargs)

DEPRECATION WARNING: The all_components method is deprecated. Use the Block.component_objects() method. (deprecated in 4.1.10486)

block_data_objects(active=None, sort=False, descend_into=True, descent_order=None)

This method returns a generator that iterates through the current block and recursively all sub-blocks. This is semantically equivalent to

component_data_objects(Block, …)
clear_suffix_value(suffix_or_name, expand=True)

Set the suffix value for this component data

clone()

TODO

cname(*args, **kwds)

DEPRECATION WARNING: The cname() method has been renamed to getname(). The preferred method of obtaining a component name is to use the .name property, which returns the fully qualified component name. The .local_name property will return the component name only within the context of the immediate parent container. (deprecated in 5.0)

collect_ctypes(active=None, descend_into=True)

Count all component types stored on or under this block.

Parameters: active (True/None) – Set to True to indicate that only active components should be counted. The default value of None indicates that all components (including those that have been deactivated) should be counted. descend_into (bool) – Indicates whether or not component types should be counted on sub-blocks. Default is True.

Returns: A set of component types.

component(name_or_object)

Return a child component of this block.

If passed a string, this will return the child component registered by that name. If passed a component, this will return that component IFF the component is a child of this block. Returns None on lookup failure.

component_data_iterindex(ctype=None, active=None, sort=False, descend_into=True, descent_order=None)

Return a generator that returns a tuple for each component data object in a block. By default, this generator recursively descends into sub-blocks. The tuple is

((component name, index value), _ComponentData)
component_data_objects(ctype=None, active=None, sort=False, descend_into=True, descent_order=None)

Return a generator that iterates through the component data objects for all components in a block. By default, this generator recursively descends into sub-blocks.

component_map(ctype=None, active=None, sort=False)

Returns a PseudoMap of the components in this block.

Parameters:
• ctype (None or type or iterable) –

Specifies the component types (ctypes) to include in the resulting PseudoMap

 None All components type A single component type iterable All component types in the iterable
• active (None or bool) –

Filter components by the active flag

 None Return all components True Return only active components False Return only inactive components
• sort (bool) –

Iterate over the components in a sorted otder

 True Iterate using Block.alphabetizeComponentAndIndex False Iterate using Block.declarationOrder
component_objects(ctype=None, active=None, sort=False, descend_into=True, descent_order=None)

Return a generator that iterates through the component objects in a block. By default, the generator recursively descends into sub-blocks.

compute_statistics(active=True)

Compute model statistics

construct(data=None)

Initialize the block

contains_component(ctype)

Return True if the component type is in _ctypes and … TODO.

create(filename=None, **kwargs)

DEPRECATION WARNING: The Model.create() method is deprecated. Call Model.create_instance() to create a concrete instance from an abstract model. You do not need to call Model.create() for a concrete model. (deprecated in 4.3.11323)

Create a concrete instance of this Model, possibly using data read in from a file.

create_instance(filename=None, data=None, name=None, namespace=None, namespaces=None, profile_memory=0, report_timing=False, **kwds)

Create a concrete instance of an abstract model, possibly using data read in from a file.

Parameters: filename (str, optional) – The name of a Pyomo Data File that will be used to load data into the model. data (dict, optional) – A dictionary containing initialization data for the model to be used if there is no filename name (str, optional) – The name given to the model. namespace (str, optional) – A namespace used to select data. namespaces (list, optional) – A list of namespaces used to select data. profile_memory (int, optional) – A number that indicates the profiling level. report_timing (bool, optional) – Report timing statistics during construction.
ctype

Return the class type for this component

deactivate()

Set the active attribute to False

del_component(name_or_object)

Delete a component from this block.

dim()

Return the dimension of the index

display(filename=None, ostream=None, prefix='')

Display values in the block

find_component(label_or_component)

Return a block component given a name.

get_suffix_value(suffix_or_name, default=None)

Get the suffix value for this component data

getname(fully_qualified=False, name_buffer=None, relative_to=None)

Return a string with the component name and index

id_index_map()

Return an dictionary id->index for all ComponentData instances.

index()

Returns the index of this ComponentData instance relative to the parent component index set. None is returned if this instance does not have a parent component, or if - for some unknown reason - this instance does not belong to the parent component’s index set. This method is not intended to be a fast method; it should be used rarely, primarily in cases of label formulation.

index_set()

Return the index set

is_component_type()

Return True if this class is a Pyomo component

is_constructed()

A boolean indicating whether or not all active components of the input model have been properly constructed.

is_expression_type()

Return True if this numeric value is an expression

is_indexed()

Return true if this component is indexed

is_logical_type()

Return True if this class is a Pyomo Boolean value, variable, or expression.

is_named_expression_type()

Return True if this numeric value is a named expression

is_numeric_type()

Return True if this class is a Pyomo numeric object

is_parameter_type()

Return False unless this class is a parameter object

is_reference()

Return True if this component is a reference, where “reference” is interpreted as any component that does not own its own data.

is_variable_type()

Return False unless this class is a variable object

items()

Return an iterator of (index,data) tuples from the dictionary

iteritems()

Return an iterator of (index,data) tuples from the dictionary

iterkeys()

Return an iterator of the keys in the dictionary

itervalues()

Return an iterator of the component data objects in the dictionary

keys()

Return an iterator of the keys in the dictionary

load(arg, namespaces=[None], profile_memory=0, report_timing=None)

Load the model with data from a file, dictionary or DataPortal object.

local_name

Get the component name only within the context of the immediate parent container.

model()

Return the model of the component that owns this data.

name

Get the fully qualifed component name.

parent_block()

Return the parent of the component that owns this data.

parent_component()

Returns the component associated with this object.

pprint(ostream=None, verbose=False, prefix='')

Print component information

preprocess(preprocessor=None)

Apply the preprocess plugins defined by the user

preprocessor_ep = <ExtensionPoint IPyomoPresolver env=pyomo>
reclassify_component_type(name_or_object, new_ctype, preserve_declaration_order=True)

TODO

reconstruct(data=None)

Re-construct model expressions

root_block()

Return self.model()

set_suffix_value(suffix_or_name, value, expand=True)

Set the suffix value for this component data

to_dense_data()

TODO

to_string(verbose=None, labeler=None, smap=None, compute_values=False)

Return a string representation of this component, applying the labeler if passed one.

transfer_attributes_from(src)

Transfer user-defined attributes from src to this block

This transfers all components and user-defined attributes from the block or dictionary src and places them on this Block. Components are transferred in declaration order.

If a Component on src is also declared on this block as either a Component or attribute, the local Component or attribute is replaced by the incoming component. If an attribute name on src matches a Component declared on this block, then the incoming attribute is passed to the local Component’s set_value() method. Attribute names appearing in this block’s _Block_reserved_words set will not be transferred (although Components will be).

Parameters: src (_BlockData or dict) – The Block or mapping that contains the new attributes to assign to this block.
transform(name=None, **kwds)

DEPRECATION WARNING: Model.transform() is deprecated. (deprecated in 4.3.11323)

type()

DEPRECATION WARNING: Component.type() method has been replaced by the .ctype property. (deprecated in 5.7)

Return the class type for this component

valid_model_component()

Return True if this can be used as a model component.

valid_problem_types()

This method allows the pyomo.opt convert function to work with a Model object.

values()

Return an iterator of the component data objects in the dictionary

write(filename=None, format=None, solver_capability=None, io_options={})

Write the model to a file, with a given format.

class pyomo.environ.AbstractModel(*args, **kwds)[source]

Bases: pyomo.core.base.PyomoModel.Model

An abstract optimization model that defers construction of components.

activate()

Set the active attribute to True

active

Return the active attribute

active_blocks(*args, **kwargs)

DEPRECATION WARNING: The active_blocks method is deprecated. Use the Block.block_data_objects() method. (deprecated in 4.1.10486)

active_component_data(*args, **kwargs)

DEPRECATION WARNING: The active_component_data method is deprecated. Use the Block.component_data_objects() method. (deprecated in 4.1.10486)

active_components(*args, **kwargs)

DEPRECATION WARNING: The active_components method is deprecated. Use the Block.component_objects() method. (deprecated in 4.1.10486)

add_component(name, val)

Add a component ‘name’ to the block.

This method assumes that the attribute is not in the model.

all_blocks(*args, **kwargs)

DEPRECATION WARNING: The all_blocks method is deprecated. Use the Block.block_data_objects() method. (deprecated in 4.1.10486)

all_component_data(*args, **kwargs)

DEPRECATION WARNING: The all_component_data method is deprecated. Use the Block.component_data_objects() method. (deprecated in 4.1.10486)

all_components(*args, **kwargs)

DEPRECATION WARNING: The all_components method is deprecated. Use the Block.component_objects() method. (deprecated in 4.1.10486)

block_data_objects(active=None, sort=False, descend_into=True, descent_order=None)

This method returns a generator that iterates through the current block and recursively all sub-blocks. This is semantically equivalent to

component_data_objects(Block, …)
clear_suffix_value(suffix_or_name, expand=True)

Set the suffix value for this component data

clone()

TODO

cname(*args, **kwds)

DEPRECATION WARNING: The cname() method has been renamed to getname(). The preferred method of obtaining a component name is to use the .name property, which returns the fully qualified component name. The .local_name property will return the component name only within the context of the immediate parent container. (deprecated in 5.0)

collect_ctypes(active=None, descend_into=True)

Count all component types stored on or under this block.

Parameters: active (True/None) – Set to True to indicate that only active components should be counted. The default value of None indicates that all components (including those that have been deactivated) should be counted. descend_into (bool) – Indicates whether or not component types should be counted on sub-blocks. Default is True.

Returns: A set of component types.

component(name_or_object)

Return a child component of this block.

If passed a string, this will return the child component registered by that name. If passed a component, this will return that component IFF the component is a child of this block. Returns None on lookup failure.

component_data_iterindex(ctype=None, active=None, sort=False, descend_into=True, descent_order=None)

Return a generator that returns a tuple for each component data object in a block. By default, this generator recursively descends into sub-blocks. The tuple is

((component name, index value), _ComponentData)
component_data_objects(ctype=None, active=None, sort=False, descend_into=True, descent_order=None)

Return a generator that iterates through the component data objects for all components in a block. By default, this generator recursively descends into sub-blocks.

component_map(ctype=None, active=None, sort=False)

Returns a PseudoMap of the components in this block.

Parameters:
• ctype (None or type or iterable) –

Specifies the component types (ctypes) to include in the resulting PseudoMap

 None All components type A single component type iterable All component types in the iterable
• active (None or bool) –

Filter components by the active flag

 None Return all components True Return only active components False Return only inactive components
• sort (bool) –

Iterate over the components in a sorted otder

 True Iterate using Block.alphabetizeComponentAndIndex False Iterate using Block.declarationOrder
component_objects(ctype=None, active=None, sort=False, descend_into=True, descent_order=None)

Return a generator that iterates through the component objects in a block. By default, the generator recursively descends into sub-blocks.

compute_statistics(active=True)

Compute model statistics

construct(data=None)

Initialize the block

contains_component(ctype)

Return True if the component type is in _ctypes and … TODO.

create(filename=None, **kwargs)

DEPRECATION WARNING: The Model.create() method is deprecated. Call Model.create_instance() to create a concrete instance from an abstract model. You do not need to call Model.create() for a concrete model. (deprecated in 4.3.11323)

Create a concrete instance of this Model, possibly using data read in from a file.

create_instance(filename=None, data=None, name=None, namespace=None, namespaces=None, profile_memory=0, report_timing=False, **kwds)

Create a concrete instance of an abstract model, possibly using data read in from a file.

Parameters: filename (str, optional) – The name of a Pyomo Data File that will be used to load data into the model. data (dict, optional) – A dictionary containing initialization data for the model to be used if there is no filename name (str, optional) – The name given to the model. namespace (str, optional) – A namespace used to select data. namespaces (list, optional) – A list of namespaces used to select data. profile_memory (int, optional) – A number that indicates the profiling level. report_timing (bool, optional) – Report timing statistics during construction.
ctype

Return the class type for this component

deactivate()

Set the active attribute to False

del_component(name_or_object)

Delete a component from this block.

dim()

Return the dimension of the index

display(filename=None, ostream=None, prefix='')

Display values in the block

find_component(label_or_component)

Return a block component given a name.

get_suffix_value(suffix_or_name, default=None)

Get the suffix value for this component data

getname(fully_qualified=False, name_buffer=None, relative_to=None)

Return a string with the component name and index

id_index_map()

Return an dictionary id->index for all ComponentData instances.

index()

Returns the index of this ComponentData instance relative to the parent component index set. None is returned if this instance does not have a parent component, or if - for some unknown reason - this instance does not belong to the parent component’s index set. This method is not intended to be a fast method; it should be used rarely, primarily in cases of label formulation.

index_set()

Return the index set

is_component_type()

Return True if this class is a Pyomo component

is_constructed()

A boolean indicating whether or not all active components of the input model have been properly constructed.

is_expression_type()

Return True if this numeric value is an expression

is_indexed()

Return true if this component is indexed

is_logical_type()

Return True if this class is a Pyomo Boolean value, variable, or expression.

is_named_expression_type()

Return True if this numeric value is a named expression

is_numeric_type()

Return True if this class is a Pyomo numeric object

is_parameter_type()

Return False unless this class is a parameter object

is_reference()

Return True if this component is a reference, where “reference” is interpreted as any component that does not own its own data.

is_variable_type()

Return False unless this class is a variable object

items()

Return an iterator of (index,data) tuples from the dictionary

iteritems()

Return an iterator of (index,data) tuples from the dictionary

iterkeys()

Return an iterator of the keys in the dictionary

itervalues()

Return an iterator of the component data objects in the dictionary

keys()

Return an iterator of the keys in the dictionary

load(arg, namespaces=[None], profile_memory=0, report_timing=None)

Load the model with data from a file, dictionary or DataPortal object.

local_name

Get the component name only within the context of the immediate parent container.

model()

Return the model of the component that owns this data.

name

Get the fully qualifed component name.

parent_block()

Return the parent of the component that owns this data.

parent_component()

Returns the component associated with this object.

pprint(ostream=None, verbose=False, prefix='')

Print component information

preprocess(preprocessor=None)

Apply the preprocess plugins defined by the user

preprocessor_ep = <ExtensionPoint IPyomoPresolver env=pyomo>
reclassify_component_type(name_or_object, new_ctype, preserve_declaration_order=True)

TODO

reconstruct(data=None)

Re-construct model expressions

root_block()

Return self.model()

set_suffix_value(suffix_or_name, value, expand=True)

Set the suffix value for this component data

to_dense_data()

TODO

to_string(verbose=None, labeler=None, smap=None, compute_values=False)

Return a string representation of this component, applying the labeler if passed one.

transfer_attributes_from(src)

Transfer user-defined attributes from src to this block

This transfers all components and user-defined attributes from the block or dictionary src and places them on this Block. Components are transferred in declaration order.

If a Component on src is also declared on this block as either a Component or attribute, the local Component or attribute is replaced by the incoming component. If an attribute name on src matches a Component declared on this block, then the incoming attribute is passed to the local Component’s set_value() method. Attribute names appearing in this block’s _Block_reserved_words set will not be transferred (although Components will be).

Parameters: src (_BlockData or dict) – The Block or mapping that contains the new attributes to assign to this block.
transform(name=None, **kwds)

DEPRECATION WARNING: Model.transform() is deprecated. (deprecated in 4.3.11323)

type()

DEPRECATION WARNING: Component.type() method has been replaced by the .ctype property. (deprecated in 5.7)

Return the class type for this component

valid_model_component()

Return True if this can be used as a model component.

valid_problem_types()

This method allows the pyomo.opt convert function to work with a Model object.

values()

Return an iterator of the component data objects in the dictionary

write(filename=None, format=None, solver_capability=None, io_options={})

Write the model to a file, with a given format.

class pyomo.environ.Block(*args, **kwargs)[source]

Bases: pyomo.core.base.indexed_component.ActiveIndexedComponent

Blocks are indexed components that contain other components (including blocks). Blocks have a global attribute that defines whether construction is deferred. This applies to all components that they contain except blocks. Blocks contained by other blocks use their local attribute to determine whether construction is deferred.

activate()

Set the active attribute to True

active

Return the active attribute

clear()

Clear the data in this component

clear_suffix_value(suffix_or_name, expand=True)

Clear the suffix value for this component data

cname(*args, **kwds)

DEPRECATION WARNING: The cname() method has been renamed to getname(). The preferred method of obtaining a component name is to use the .name property, which returns the fully qualified component name. The .local_name property will return the component name only within the context of the immediate parent container. (deprecated in 5.0)

construct(data=None)[source]

Initialize the block

ctype

Return the class type for this component

deactivate()

Set the active attribute to False

dim()

Return the dimension of the index

display(filename=None, ostream=None, prefix='')[source]

Display values in the block

get_suffix_value(suffix_or_name, default=None)

Get the suffix value for this component data

getname(fully_qualified=False, name_buffer=None, relative_to=None)

Returns the component name associated with this object.

Parameters: fully_qualified (bool) – Generate full name from nested block names name_buffer (dict) – A dictionary that caches encountered names and indices. Providing a name_buffer can significantly speed up iterative name generation relative_to (Block) – Generate fully_qualified names reletive to the specified block.
id_index_map()

Return an dictionary id->index for all ComponentData instances.

index_set()

Return the index set

is_component_type()

Return True if this class is a Pyomo component

is_constructed()

Return True if this class has been constructed

is_expression_type()

Return True if this numeric value is an expression

is_indexed()

Return true if this component is indexed

is_logical_type()

Return True if this class is a Pyomo Boolean value, variable, or expression.

is_named_expression_type()

Return True if this numeric value is a named expression

is_numeric_type()

Return True if this class is a Pyomo numeric object

is_parameter_type()

Return False unless this class is a parameter object

is_reference()

Return True if this component is a reference, where “reference” is interpreted as any component that does not own its own data.

is_variable_type()

Return False unless this class is a variable object

items()

Return an iterator of (index,data) tuples from the dictionary

iteritems()

Return an iterator of (index,data) tuples from the dictionary

iterkeys()

Return an iterator of the keys in the dictionary

itervalues()

Return an iterator of the component data objects in the dictionary

keys()

Return an iterator of the keys in the dictionary

local_name

Get the component name only within the context of the immediate parent container.

model()

Returns the model associated with this object.

name

Get the fully qualifed component name.

parent_block()

Returns the parent of this object.

parent_component()

Returns the component associated with this object.

pprint(ostream=None, verbose=False, prefix='')

Print component information

reconstruct(data=None)

Re-construct model expressions

root_block()

Return self.model()

set_suffix_value(suffix_or_name, value, expand=True)

Set the suffix value for this component data

set_value(value)

Set the value of a scalar component.

to_dense_data()

TODO

to_string(verbose=None, labeler=None, smap=None, compute_values=False)

Return the component name

type()

DEPRECATION WARNING: Component.type() method has been replaced by the .ctype property. (deprecated in 5.7)

Return the class type for this component

valid_model_component()

Return True if this can be used as a model component.

values()

Return an iterator of the component data objects in the dictionary

class pyomo.environ.Constraint(*args, **kwargs)[source]

Bases: pyomo.core.base.indexed_component.ActiveIndexedComponent

This modeling component defines a constraint expression using a rule function.

Constructor arguments:
expr
A Pyomo expression for this constraint
rule
A function that is used to construct constraint expressions
doc
A text string describing this component
name
A name for this component
Public class attributes:
doc
A text string describing this component
name
A name for this component
active
A boolean that is true if this component will be used to construct a model instance
rule
The rule used to initialize the constraint(s)
Private class attributes:
_constructed
A boolean that is true if this component has been constructed
_data
A dictionary from the index set to component data objects
_index
The set of valid indices
_implicit_subsets
A tuple of set objects that represents the index set
_model
A weakref to the model that owns this component
_parent
A weakref to the parent block that owns this component
_type
The class type for the derived subclass
activate()

Set the active attribute to True

active

Return the active attribute

clear()

Clear the data in this component

clear_suffix_value(suffix_or_name, expand=True)

Clear the suffix value for this component data

cname(*args, **kwds)

DEPRECATION WARNING: The cname() method has been renamed to getname(). The preferred method of obtaining a component name is to use the .name property, which returns the fully qualified component name. The .local_name property will return the component name only within the context of the immediate parent container. (deprecated in 5.0)

construct(data=None)[source]

Construct the expression(s) for this constraint.

ctype

Return the class type for this component

deactivate()

Set the active attribute to False

dim()

Return the dimension of the index

display(prefix='', ostream=None)[source]

Print component state information

This duplicates logic in Component.pprint()

get_suffix_value(suffix_or_name, default=None)

Get the suffix value for this component data

getname(fully_qualified=False, name_buffer=None, relative_to=None)

Returns the component name associated with this object.

Parameters: fully_qualified (bool) – Generate full name from nested block names name_buffer (dict) – A dictionary that caches encountered names and indices. Providing a name_buffer can significantly speed up iterative name generation relative_to (Block) – Generate fully_qualified names reletive to the specified block.
id_index_map()

Return an dictionary id->index for all ComponentData instances.

index_set()

Return the index set

is_component_type()

Return True if this class is a Pyomo component

is_constructed()

Return True if this class has been constructed

is_expression_type()

Return True if this numeric value is an expression

is_indexed()

Return true if this component is indexed

is_logical_type()

Return True if this class is a Pyomo Boolean value, variable, or expression.

is_named_expression_type()

Return True if this numeric value is a named expression

is_numeric_type()

Return True if this class is a Pyomo numeric object

is_parameter_type()

Return False unless this class is a parameter object

is_reference()

Return True if this component is a reference, where “reference” is interpreted as any component that does not own its own data.

is_variable_type()

Return False unless this class is a variable object

items()

Return an iterator of (index,data) tuples from the dictionary

iteritems()

Return an iterator of (index,data) tuples from the dictionary

iterkeys()

Return an iterator of the keys in the dictionary

itervalues()

Return an iterator of the component data objects in the dictionary

keys()

Return an iterator of the keys in the dictionary

local_name

Get the component name only within the context of the immediate parent container.

model()

Returns the model associated with this object.

name

Get the fully qualifed component name.

parent_block()

Returns the parent of this object.

parent_component()

Returns the component associated with this object.

pprint(ostream=None, verbose=False, prefix='')

Print component information

reconstruct(data=None)

Re-construct model expressions

root_block()

Return self.model()

set_suffix_value(suffix_or_name, value, expand=True)

Set the suffix value for this component data

set_value(value)

Set the value of a scalar component.

to_dense_data()

TODO

to_string(verbose=None, labeler=None, smap=None, compute_values=False)

Return the component name

type()

DEPRECATION WARNING: Component.type() method has been replaced by the .ctype property. (deprecated in 5.7)

Return the class type for this component

valid_model_component()

Return True if this can be used as a model component.

values()

Return an iterator of the component data objects in the dictionary

class pyomo.environ.Objective(*args, **kwargs)[source]

Bases: pyomo.core.base.indexed_component.ActiveIndexedComponent

This modeling component defines an objective expression.

Note that this is a subclass of NumericValue to allow objectives to be used as part of expressions.

Constructor arguments:
expr
A Pyomo expression for this objective
rule
A function that is used to construct objective expressions
sense
Indicate whether minimizing (the default) or maximizing
doc
A text string describing this component
name
A name for this component
Public class attributes:
doc
A text string describing this component
name
A name for this component
active
A boolean that is true if this component will be used to construct a model instance
rule
The rule used to initialize the objective(s)
sense
The objective sense
Private class attributes:
_constructed
A boolean that is true if this component has been constructed
_data
A dictionary from the index set to component data objects
_index
The set of valid indices
_implicit_subsets
A tuple of set objects that represents the index set
_model
A weakref to the model that owns this component
_parent
A weakref to the parent block that owns this component
_type
The class type for the derived subclass
activate()

Set the active attribute to True

active

Return the active attribute

clear()

Clear the data in this component

clear_suffix_value(suffix_or_name, expand=True)

Clear the suffix value for this component data

cname(*args, **kwds)

DEPRECATION WARNING: The cname() method has been renamed to getname(). The preferred method of obtaining a component name is to use the .name property, which returns the fully qualified component name. The .local_name property will return the component name only within the context of the immediate parent container. (deprecated in 5.0)

construct(data=None)[source]

Construct the expression(s) for this objective.

ctype

Return the class type for this component

deactivate()

Set the active attribute to False

dim()

Return the dimension of the index

display(prefix='', ostream=None)[source]

Provide a verbose display of this object

get_suffix_value(suffix_or_name, default=None)

Get the suffix value for this component data

getname(fully_qualified=False, name_buffer=None, relative_to=None)

Returns the component name associated with this object.

Parameters: fully_qualified (bool) – Generate full name from nested block names name_buffer (dict) – A dictionary that caches encountered names and indices. Providing a name_buffer can significantly speed up iterative name generation relative_to (Block) – Generate fully_qualified names reletive to the specified block.
id_index_map()

Return an dictionary id->index for all ComponentData instances.

index_set()

Return the index set

is_component_type()

Return True if this class is a Pyomo component

is_constructed()

Return True if this class has been constructed

is_expression_type()

Return True if this numeric value is an expression

is_indexed()

Return true if this component is indexed

is_logical_type()

Return True if this class is a Pyomo Boolean value, variable, or expression.

is_named_expression_type()

Return True if this numeric value is a named expression

is_numeric_type()

Return True if this class is a Pyomo numeric object

is_parameter_type()

Return False unless this class is a parameter object

is_reference()

Return True if this component is a reference, where “reference” is interpreted as any component that does not own its own data.

is_variable_type()

Return False unless this class is a variable object

items()

Return an iterator of (index,data) tuples from the dictionary

iteritems()

Return an iterator of (index,data) tuples from the dictionary

iterkeys()

Return an iterator of the keys in the dictionary

itervalues()

Return an iterator of the component data objects in the dictionary

keys()

Return an iterator of the keys in the dictionary

local_name

Get the component name only within the context of the immediate parent container.

model()

Returns the model associated with this object.

name

Get the fully qualifed component name.

parent_block()

Returns the parent of this object.

parent_component()

Returns the component associated with this object.

pprint(ostream=None, verbose=False, prefix='')

Print component information

reconstruct(data=None)

Re-construct model expressions

root_block()

Return self.model()

set_suffix_value(suffix_or_name, value, expand=True)

Set the suffix value for this component data

set_value(value)

Set the value of a scalar component.

to_dense_data()

TODO

to_string(verbose=None, labeler=None, smap=None, compute_values=False)

Return the component name

type()

DEPRECATION WARNING: Component.type() method has been replaced by the .ctype property. (deprecated in 5.7)

Return the class type for this component

valid_model_component()

Return True if this can be used as a model component.

values()

Return an iterator of the component data objects in the dictionary

class pyomo.environ.Param(*args, **kwd)[source]

Bases: pyomo.core.base.indexed_component.IndexedComponent

A parameter value, which may be defined over an index.

Constructor Arguments:
name
The name of this parameter
index
The index set that defines the distinct parameters. By default, this is None, indicating that there is a single parameter.
domain
A set that defines the type of values that each parameter must be.
within
A set that defines the type of values that each parameter must be.
validate
A rule for validating this parameter w.r.t. data that exists in the model
default
A scalar, rule, or dictionary that defines default values for this parameter
initialize
A dictionary or rule for setting up this parameter with existing model data
unit: pyomo unit expression
An expression containing the units for the parameter
mutable: boolean
Flag indicating if the value of the parameter may change between calls to a solver. Defaults to False
active

Return the active attribute

clear()

Clear the data in this component

clear_suffix_value(suffix_or_name, expand=True)

Clear the suffix value for this component data

cname(*args, **kwds)

DEPRECATION WARNING: The cname() method has been renamed to getname(). The preferred method of obtaining a component name is to use the .name property, which returns the fully qualified component name. The .local_name property will return the component name only within the context of the immediate parent container. (deprecated in 5.0)

construct(data=None)[source]

Initialize this component.

A parameter is constructed using the initial data or the data loaded from an external source. We first set all the values based on self._rule, and then allow the data dictionary to overwrite anything.

Note that we allow an undefined Param value to be constructed. We throw an exception if a user tries to use an uninitialized Param.

ctype

Return the class type for this component

default()[source]

Return the value of the parameter default.

Possible values:
None
No default value is provided.
Numeric
A constant value that is the default value for all undefined parameters.
Function
f(model, i) returns the value for the default value for parameter i
dim()

Return the dimension of the index

extract_values()[source]

A utility to extract all index-value pairs defined for this parameter, returned as a dictionary.

This method is useful in contexts where key iteration and repeated __getitem__ calls are too expensive to extract the contents of a parameter.

extract_values_sparse()[source]

A utility to extract all index-value pairs defined with non-default values, returned as a dictionary.

This method is useful in contexts where key iteration and repeated __getitem__ calls are too expensive to extract the contents of a parameter.

get_suffix_value(suffix_or_name, default=None)

Get the suffix value for this component data

get_units()[source]

Return the units for this ParamData

getname(fully_qualified=False, name_buffer=None, relative_to=None)

Returns the component name associated with this object.

Parameters: fully_qualified (bool) – Generate full name from nested block names name_buffer (dict) – A dictionary that caches encountered names and indices. Providing a name_buffer can significantly speed up iterative name generation relative_to (Block) – Generate fully_qualified names reletive to the specified block.
id_index_map()

Return an dictionary id->index for all ComponentData instances.

index_set()

Return the index set

is_component_type()

Return True if this class is a Pyomo component

is_constructed()

Return True if this class has been constructed

is_expression_type()

Return True if this numeric value is an expression

is_indexed()

Return true if this component is indexed

is_logical_type()

Return True if this class is a Pyomo Boolean value, variable, or expression.

is_named_expression_type()

Return True if this numeric value is a named expression

is_numeric_type()

Return True if this class is a Pyomo numeric object

is_parameter_type()

Return False unless this class is a parameter object

is_reference()

Return True if this component is a reference, where “reference” is interpreted as any component that does not own its own data.

is_variable_type()

Return False unless this class is a variable object

items()

Return an iterator of (index,data) tuples from the dictionary

iteritems()

Return an iterator of (index,data) tuples from the dictionary

iterkeys()

Return an iterator of the keys in the dictionary

itervalues()

Return an iterator of the component data objects in the dictionary

keys()

Return an iterator of the keys in the dictionary

local_name

Get the component name only within the context of the immediate parent container.

model()

Returns the model associated with this object.

name

Get the fully qualifed component name.

parent_block()

Returns the parent of this object.

parent_component()

Returns the component associated with this object.

pprint(ostream=None, verbose=False, prefix='')

Print component information

reconstruct(data=None)[source]

Reconstruct this parameter object. This is particularly useful for cases where an initialize rule is provided. An initialize rule can return an expression that is a function of other parameters, so reconstruction can account for changes in dependent parameters.

Only mutable parameters can be reconstructed. Otherwise, the changes would not be propagated into expressions in objectives or constraints.

root_block()

Return self.model()

set_default(val)[source]

Perform error checks and then set the default value for this parameter.

NOTE: this test will not validate the value of function return values.

set_suffix_value(suffix_or_name, value, expand=True)

Set the suffix value for this component data

set_value(value)

Set the value of a scalar component.

sparse_items()[source]

Return a list (index,data) tuples for defined parameters

sparse_iteritems()[source]

Return an iterator of (index,data) tuples for defined parameters

sparse_iterkeys()[source]

Return an iterator for the keys in the defined parameters

sparse_itervalues()[source]

Return an iterator for the defined param data objects

sparse_keys()[source]

Return a list of keys in the defined parameters

sparse_values()[source]

Return a list of the defined param data objects

store_values(new_values, check=True)[source]

A utility to update a Param with a dictionary or scalar.

If check=True, then both the index and value are checked through the __getitem__ method. Using check=False should only be used by developers!

to_dense_data()

TODO

to_string(verbose=None, labeler=None, smap=None, compute_values=False)

Return the component name

type()

DEPRECATION WARNING: Component.type() method has been replaced by the .ctype property. (deprecated in 5.7)

Return the class type for this component

valid_model_component()

Return True if this can be used as a model component.

values()

Return an iterator of the component data objects in the dictionary

class pyomo.environ.RangeSet(*args, **kwds)[source]

Bases: pyomo.core.base.component.Component

A set object that represents a set of numeric values

RangeSet objects are based around NumericRange objects, which include support for non-finite ranges (both continuous and unbounded). Similarly, boutique ranges (like semi-continuous domains) can be represented, e.g.:

>>> from pyomo.core.base.range import NumericRange
>>> from pyomo.environ import RangeSet
>>> print(RangeSet(ranges=(NumericRange(0,0,0), NumericRange(1,100,0))))
([0] | [1..100])


The RangeSet object continues to support the notation for specifying discrete ranges using “[first=1], last, [step=1]” values:

>>> r = RangeSet(3)
>>> print(r)
[1:3]
>>> print(list(r))
[1, 2, 3]

>>> r = RangeSet(2, 5)
>>> print(r)
[2:5]
>>> print(list(r))
[2, 3, 4, 5]

>>> r = RangeSet(2, 5, 2)
>>> print(r)
[2:4:2]
>>> print(list(r))
[2, 4]

>>> r = RangeSet(2.5, 4, 0.5)
>>> print(r)
([2.5] | [3.0] | [3.5] | [4.0])
>>> print(list(r))
[2.5, 3.0, 3.5, 4.0]


By implementing RangeSet using NumericRanges, the global Sets (like Reals, Integers, PositiveReals, etc.) are trivial instances of a RangeSet and support all Set operations.

Parameters: *args (int | float | None) – The range defined by ([start=1], end, [step=1]). If only a single positional parameter, end is supplied, then the RangeSet will be the integers starting at 1 up through and including end. Providing two positional arguments, x and y, will result in a range starting at x up to and including y, incrementing by 1. Providing a 3-tuple enables the specification of a step other than 1. finite (bool, optional) – This sets if this range is finite (discrete and bounded) or infinite ranges (iterable, optional) – The list of range objects that compose this RangeSet bounds (tuple, optional) – The lower and upper bounds of values that are admissible in this RangeSet filter (function, optional) – Function (rule) that returns True if the specified value is in the RangeSet or False if it is not. validate (function, optional) – Data validation function (rule). The function will be called for every data member of the set, and if it returns False, a ValueError will be raised.
active

Return the active attribute

clear_suffix_value(suffix_or_name, expand=True)

Clear the suffix value for this component data

cname(*args, **kwds)

DEPRECATION WARNING: The cname() method has been renamed to getname(). The preferred method of obtaining a component name is to use the .name property, which returns the fully qualified component name. The .local_name property will return the component name only within the context of the immediate parent container. (deprecated in 5.0)

construct(data=None)[source]

API definition for constructing components

ctype

Return the class type for this component

get_suffix_value(suffix_or_name, default=None)

Get the suffix value for this component data

getname(fully_qualified=False, name_buffer=None, relative_to=None)

Returns the component name associated with this object.

Parameters: fully_qualified (bool) – Generate full name from nested block names name_buffer (dict) – A dictionary that caches encountered names and indices. Providing a name_buffer can significantly speed up iterative name generation relative_to (Block) – Generate fully_qualified names reletive to the specified block.
is_component_type()

Return True if this class is a Pyomo component

is_constructed()

Return True if this class has been constructed

is_expression_type()

Return True if this numeric value is an expression

is_indexed()

Return true if this component is indexed

is_logical_type()

Return True if this class is a Pyomo Boolean value, variable, or expression.

is_named_expression_type()

Return True if this numeric value is a named expression

is_numeric_type()

Return True if this class is a Pyomo numeric object

is_parameter_type()

Return False unless this class is a parameter object

is_reference()

Return True if this object is a reference.

is_variable_type()

Return False unless this class is a variable object

local_name

Get the component name only within the context of the immediate parent container.

model()

Returns the model associated with this object.

name

Get the fully qualifed component name.

parent_block()

Returns the parent of this object.

parent_component()

Returns the component associated with this object.

pprint(ostream=None, verbose=False, prefix='')

Print component information

reconstruct(data=None)

Re-construct model expressions

root_block()

Return self.model()

set_suffix_value(suffix_or_name, value, expand=True)

Set the suffix value for this component data

to_string(verbose=None, labeler=None, smap=None, compute_values=False)

Return the component name

type()

DEPRECATION WARNING: Component.type() method has been replaced by the .ctype property. (deprecated in 5.7)

Return the class type for this component

valid_model_component()

Return True if this can be used as a model component.

pyomo.environ.Reference(reference, ctype=<object object>)[source]

Creates a component that references other components

Reference generates a reference component; that is, an indexed component that does not contain data, but instead references data stored in other components as defined by a component slice. The ctype parameter sets the Component.type() of the resulting indexed component. If the ctype parameter is not set and all data identified by the slice (at construction time) share a common Component.type(), then that type is assumed. If either the ctype parameter is None or the data has more than one ctype, the resulting indexed component will have a ctype of IndexedComponent.

If the indices associated with wildcards in the component slice all refer to the same Set objects for all data identifed by the slice, then the resulting indexed component will be indexed by the product of those sets. However, if all data do not share common set objects, or only a subset of indices in a multidimentional set appear as wildcards, then the resulting indexed component will be indexed by a SetOf containing a _ReferenceSet for the slice.

Parameters: reference (IndexedComponent_slice) – component slice that defines the data to include in the Reference component ctype (type [optional]) – the type used to create the resulting indexed component. If not specified, the data’s ctype will be used (if all data share a common ctype). If multiple data ctypes are found or type is None, then IndexedComponent will be used.

Examples

>>> from pyomo.environ import *
>>> m = ConcreteModel()
>>> @m.Block([1,2],[3,4])
... def b(b,i,j):
...     b.x = Var(bounds=(i,j))
...
>>> m.r1 = Reference(m.b[:,:].x)
>>> m.r1.pprint()
r1 : Size=4, Index=r1_index
Key    : Lower : Value : Upper : Fixed : Stale : Domain
(1, 3) :     1 :  None :     3 : False :  True :  Reals
(1, 4) :     1 :  None :     4 : False :  True :  Reals
(2, 3) :     2 :  None :     3 : False :  True :  Reals
(2, 4) :     2 :  None :     4 : False :  True :  Reals


Reference components may also refer to subsets of the original data:

>>> m.r2 = Reference(m.b[:,3].x)
>>> m.r2.pprint()
r2 : Size=2, Index=b_index_0
Key : Lower : Value : Upper : Fixed : Stale : Domain
1 :     1 :  None :     3 : False :  True :  Reals
2 :     2 :  None :     3 : False :  True :  Reals


Reference components may have wildcards at multiple levels of the model hierarchy:

>>> from pyomo.environ import *
>>> m = ConcreteModel()
>>> @m.Block([1,2])
... def b(b,i):
...     b.x = Var([3,4], bounds=(i,None))
...
>>> m.r3 = Reference(m.b[:].x[:])
>>> m.r3.pprint()
r3 : Size=4, Index=r3_index
Key    : Lower : Value : Upper : Fixed : Stale : Domain
(1, 3) :     1 :  None :  None : False :  True :  Reals
(1, 4) :     1 :  None :  None : False :  True :  Reals
(2, 3) :     2 :  None :  None : False :  True :  Reals
(2, 4) :     2 :  None :  None : False :  True :  Reals


The resulting reference component may be used just like any other component. Changes to the stored data will be reflected in the original objects:

>>> m.r3[1,4] = 10
>>> m.b[1].x.pprint()
x : Size=2, Index=b[1].x_index
Key : Lower : Value : Upper : Fixed : Stale : Domain
3 :     1 :  None :  None : False :  True :  Reals
4 :     1 :    10 :  None : False : False :  Reals

class pyomo.environ.Set(*args, **kwds)[source]

Bases: pyomo.core.base.indexed_component.IndexedComponent

A component used to index other Pyomo components.

This class provides a Pyomo component that is API-compatible with Python set objects, with additional features, including:

1. Member validation and filtering. The user can declare domains and provide callback functions to validate set members and to filter (ignore) potential members.
2. Set expressions. Operations on Set objects (&,|,*,-,^) produce Set expressions taht preserve their references to the original Set objects so that updating the argument Sets implicitly updates the Set operator instance.
3. Support for set operations with RangeSet instances (both finite and non-finite ranges).
Parameters:
• name (str, optional) – The name of the set
• doc (str, optional) – A text string describing this component
• initialize (initializer(iterable), optional) – The initial values to store in the Set when it is constructed. Values passed to initialize may be overridden by data passed to the construct() method.
• dimen (initializer(int), optional) – Specify the Set’s arity (the required tuple length for all members of the Set), or None if no arity is enforced
• ordered (bool or Set.InsertionOrder or Set.SortedOrder or function) –

Specifies whether the set is ordered. Possible values are:

 False Unordered True Ordered by insertion order Set.InsertionOrder Ordered by insertion order [default] Set.SortedOrder Ordered by sort order  Ordered with this comparison function
• within (initialiser(set), optional) – A set that defines the valid values that can be contained in this set
• domain (initializer(set), optional) – A set that defines the valid values that can be contained in this set
• bounds (initializer(tuple), optional) – A tuple that specifies the bounds for valid Set values (accepts 1-, 2-, or 3-tuple RangeSet arguments)
• filter (initializer(rule), optional) –

A rule for determining membership in this set. This has the functional form:

f: Block, *data -> bool

and returns True if the data belongs in the set. Set will quietly ignore any values where filter returns False.

• validate (initializer(rule), optional) –

A rule for validating membership in this set. This has the functional form:

f: Block, *data -> bool

and returns True if the data belongs in the set. Set will raise a ValueError for any values where validate returns False.

Notes

Note

domain=, within=, and bounds= all provide restrictions on the valid set values. If more than one is specified, Set values will be restricted to the intersection of domain, within, and bounds.

active

Return the active attribute

check_values()[source]

DEPRECATION WARNING: check_values() is deprecated: Sets only contain valid members (deprecated in 5.7)

Verify that the values in this set are valid.

clear()

Clear the data in this component

clear_suffix_value(suffix_or_name, expand=True)

Clear the suffix value for this component data

cname(*args, **kwds)

DEPRECATION WARNING: The cname() method has been renamed to getname(). The preferred method of obtaining a component name is to use the .name property, which returns the fully qualified component name. The .local_name property will return the component name only within the context of the immediate parent container. (deprecated in 5.0)

construct(data=None)[source]

API definition for constructing components

ctype

Return the class type for this component

dim()

Return the dimension of the index

get_suffix_value(suffix_or_name, default=None)

Get the suffix value for this component data

getname(fully_qualified=False, name_buffer=None, relative_to=None)

Returns the component name associated with this object.

Parameters: fully_qualified (bool) – Generate full name from nested block names name_buffer (dict) – A dictionary that caches encountered names and indices. Providing a name_buffer can significantly speed up iterative name generation relative_to (Block) – Generate fully_qualified names reletive to the specified block.
id_index_map()

Return an dictionary id->index for all ComponentData instances.

index_set()

Return the index set

is_component_type()

Return True if this class is a Pyomo component

is_constructed()

Return True if this class has been constructed

is_expression_type()

Return True if this numeric value is an expression

is_indexed()

Return true if this component is indexed

is_logical_type()

Return True if this class is a Pyomo Boolean value, variable, or expression.

is_named_expression_type()

Return True if this numeric value is a named expression

is_numeric_type()

Return True if this class is a Pyomo numeric object

is_parameter_type()

Return False unless this class is a parameter object

is_reference()

Return True if this component is a reference, where “reference” is interpreted as any component that does not own its own data.

is_variable_type()

Return False unless this class is a variable object

items()

Return an iterator of (index,data) tuples from the dictionary

iteritems()

Return an iterator of (index,data) tuples from the dictionary

iterkeys()

Return an iterator of the keys in the dictionary

itervalues()

Return an iterator of the component data objects in the dictionary

keys()

Return an iterator of the keys in the dictionary

local_name

Get the component name only within the context of the immediate parent container.

model()

Returns the model associated with this object.

name

Get the fully qualifed component name.

parent_block()

Returns the parent of this object.

parent_component()

Returns the component associated with this object.

pprint(ostream=None, verbose=False, prefix='')

Print component information

reconstruct(data=None)

Re-construct model expressions

root_block()

Return self.model()

set_suffix_value(suffix_or_name, value, expand=True)

Set the suffix value for this component data

set_value(value)

Set the value of a scalar component.

to_dense_data()

TODO

to_string(verbose=None, labeler=None, smap=None, compute_values=False)

Return the component name

type()

DEPRECATION WARNING: Component.type() method has been replaced by the .ctype property. (deprecated in 5.7)

Return the class type for this component

valid_model_component()

Return True if this can be used as a model component.

values()

Return an iterator of the component data objects in the dictionary

class pyomo.environ.Var(*args, **kwd)[source]

Bases: pyomo.core.base.indexed_component.IndexedComponent

A numeric variable, which may be defined over an index.

Parameters: domain (Set or function, optional) – A Set that defines valid values for the variable (e.g., Reals, NonNegativeReals, Binary), or a rule that returns Sets. Defaults to Reals. within (Set or function, optional) – An alias for domain. bounds (tuple or function, optional) – A tuple of (lower, upper) bounds for the variable, or a rule that returns tuples. Defaults to (None, None). initialize (float or function, optional) – The initial value for the variable, or a rule that returns initial values. rule (float or function, optional) – An alias for initialize. dense (bool, optional) – Instantiate all elements from index_set() when constructing the Var (True) or just the variables returned by initialize/rule (False). Defaults to True. units (pyomo units expression, optional) – Set the units corresponding to the entries in this variable.
active

Return the active attribute

add(index)[source]

Add a variable with a particular index.

clear()

Clear the data in this component

clear_suffix_value(suffix_or_name, expand=True)

Clear the suffix value for this component data

cname(*args, **kwds)

DEPRECATION WARNING: The cname() method has been renamed to getname(). The preferred method of obtaining a component name is to use the .name property, which returns the fully qualified component name. The .local_name property will return the component name only within the context of the immediate parent container. (deprecated in 5.0)

construct(data=None)[source]

Construct this component.

ctype

Return the class type for this component

dim()

Return the dimension of the index

extract_values(include_fixed_values=True)

Return a dictionary of index-value pairs.

flag_as_stale()[source]

Set the ‘stale’ attribute of every variable data object to True.

get_suffix_value(suffix_or_name, default=None)

Get the suffix value for this component data

get_units()[source]

Return the units expression for this Var.

get_values(include_fixed_values=True)[source]

Return a dictionary of index-value pairs.

getname(fully_qualified=False, name_buffer=None, relative_to=None)

Returns the component name associated with this object.

Parameters: fully_qualified (bool) – Generate full name from nested block names name_buffer (dict) – A dictionary that caches encountered names and indices. Providing a name_buffer can significantly speed up iterative name generation relative_to (Block) – Generate fully_qualified names reletive to the specified block.
id_index_map()

Return an dictionary id->index for all ComponentData instances.

index_set()

Return the index set

is_component_type()

Return True if this class is a Pyomo component

is_constructed()

Return True if this class has been constructed

is_expression_type()

Return True if this numeric value is an expression

is_indexed()

Return true if this component is indexed

is_logical_type()

Return True if this class is a Pyomo Boolean value, variable, or expression.

is_named_expression_type()

Return True if this numeric value is a named expression

is_numeric_type()

Return True if this class is a Pyomo numeric object

is_parameter_type()

Return False unless this class is a parameter object

is_reference()

Return True if this component is a reference, where “reference” is interpreted as any component that does not own its own data.

is_variable_type()

Return False unless this class is a variable object

items()

Return an iterator of (index,data) tuples from the dictionary

iteritems()

Return an iterator of (index,data) tuples from the dictionary

iterkeys()

Return an iterator of the keys in the dictionary

itervalues()

Return an iterator of the component data objects in the dictionary

keys()

Return an iterator of the keys in the dictionary

local_name

Get the component name only within the context of the immediate parent container.

model()

Returns the model associated with this object.

name

Get the fully qualifed component name.

parent_block()

Returns the parent of this object.

parent_component()

Returns the component associated with this object.

pprint(ostream=None, verbose=False, prefix='')

Print component information

reconstruct(data=None)

Re-construct model expressions

root_block()

Return self.model()

set_suffix_value(suffix_or_name, value, expand=True)

Set the suffix value for this component data

set_value(value)

Set the value of a scalar component.

set_values(new_values, valid=False)[source]

Set the values of a dictionary.

The default behavior is to validate the values in the dictionary.

to_dense_data()

TODO

to_string(verbose=None, labeler=None, smap=None, compute_values=False)

Return the component name

type()

DEPRECATION WARNING: Component.type() method has been replaced by the .ctype property. (deprecated in 5.7)

Return the class type for this component

valid_model_component()

Return True if this can be used as a model component.

values()

Return an iterator of the component data objects in the dictionary