Suffix

(class from pyomo.core.base.suffix)

class pyomo.core.base.suffix.Suffix(*args, **kwargs)[source]

Bases: ComponentMap, ActiveComponent

A model suffix, representing extraneous model data

__init__(**kwargs)[source]

Methods

__init__(**kwargs)

activate()

Set the active attribute to True

clear()

clear_all_values()

Clears all suffix data.

clear_suffix_value(suffix_or_name[, expand])

Clear the suffix value for this component data

clear_value(component[, expand])

Clears suffix information for a component.

cname(*args, **kwds)

DEPRECATED.

construct([data])

Constructs this component, applying rule if it exists.

deactivate()

Set the active attribute to False

display([ostream, verbose, prefix])

export_enabled()

Returns True when this suffix is enabled for export to solvers.

get(k[,d])

get_datatype()

DEPRECATED.

get_direction()

DEPRECATED.

get_suffix_value(suffix_or_name[, default])

Get the suffix value for this component data

getname([fully_qualified, name_buffer, ...])

Returns the component name associated with this object.

import_enabled()

Returns True when this suffix is enabled for import from solutions.

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([expression_system])

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 object.

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

items()

keys()

model()

Returns the model associated with this object.

parent_block()

Returns the parent of this object.

parent_component()

Returns the component associated with this object.

pop(k[,d])

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem()

as a 2-tuple; but raise KeyError if D is empty.

pprint(*args, **kwds)

Print component information

reconstruct([data])

REMOVED: reconstruct() was removed in Pyomo 6.0.

root_block()

Return self.model()

set_all_values(value)

Sets the value of this suffix on all components.

set_datatype(datatype)

DEPRECATED.

set_direction(direction)

DEPRECATED.

set_suffix_value(suffix_or_name, value[, expand])

Set the suffix value for this component data

set_value(component, value[, expand])

Sets the value of this suffix on the specified component.

setdefault(k[,d])

type()

DEPRECATED.

update([E, ]**F)

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

update_values(data[, expand])

Updates the suffix data given a list of component,value tuples.

valid_model_component()

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

values()

Attributes

active

Return the active attribute

ctype

Return the class type for this component

datatype

Return the suffix datatype.

direction

Return the suffix direction.

hasher

local_name

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

name

Get the fully qualified component name.

Member Documentation

activate()

Set the active attribute to True

clear() None.  Remove all items from D.
clear_all_values()[source]

Clears all suffix data.

clear_suffix_value(suffix_or_name, expand=True)

Clear the suffix value for this component data

clear_value(component, expand=True)[source]

Clears suffix information for a component.

cname(*args, **kwds)

DEPRECATED.

Deprecated since version 5.0: 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.

construct(data=None)[source]

Constructs this component, applying rule if it exists.

deactivate()

Set the active attribute to False

export_enabled()[source]

Returns True when this suffix is enabled for export to solvers.

get(k[, d]) D[k] if k in D, else d.  d defaults to None.
get_datatype()[source]

DEPRECATED.

Return the suffix datatype.

Deprecated since version 6.7.1: Suffix.get_datatype is replaced with the Suffix.datatype property

get_direction()[source]

DEPRECATED.

Return the suffix direction.

Deprecated since version 6.7.1: Suffix.get_direction is replaced with the Suffix.direction property

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

  • relative_to (Block) – Generate fully_qualified names relative to the specified block.

import_enabled()[source]

Returns True when this suffix is enabled for import from solutions.

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(expression_system=None)

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 object.

Boolean objects include constants, variables, or logical expressions.

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

items() a set-like object providing a view on D's items
keys() a set-like object providing a view on D's keys
model()

Returns the model associated with this object.

parent_block()

Returns the parent of this object.

parent_component()

Returns the component associated with this object.

pop(k[, d]) v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem() (k, v), remove and return some (key, value) pair

as a 2-tuple; but raise KeyError if D is empty.

pprint(*args, **kwds)[source]

Print component information

reconstruct(data=None)

REMOVED: reconstruct() was removed in Pyomo 6.0.

Re-constructing model components was fragile and did not correctly update instances of the component used in other components or contexts (this was particularly problemmatic for Var, Param, and Set). Users who wish to reproduce the old behavior of reconstruct(), are comfortable manipulating non-public interfaces, and who take the time to verify that the correct thing happens to their model can approximate the old behavior of reconstruct with:

component.clear() component._constructed = False component.construct()

root_block()

Return self.model()

set_all_values(value)[source]

Sets the value of this suffix on all components.

set_datatype(datatype)[source]

DEPRECATED.

Set the suffix datatype.

Deprecated since version 6.7.1: Suffix.set_datatype is replaced with the Suffix.datatype property

set_direction(direction)[source]

DEPRECATED.

Set the suffix direction.

Deprecated since version 6.7.1: Suffix.set_direction is replaced with the Suffix.direction property

set_suffix_value(suffix_or_name, value, expand=True)

Set the suffix value for this component data

set_value(component, value, expand=True)[source]

Sets the value of this suffix on the specified component.

When expand is True (default), array components are handled by storing a reference and value for each index, with no reference being stored for the array component itself. When expand is False (this is the case for __setitem__), this behavior is disabled and a reference to the array component itself is kept.

setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D
type()

DEPRECATED.

Return the class type for this component

Deprecated since version 5.7: Component.type() method has been replaced by the .ctype property.

update([E, ]**F) None.  Update D from mapping/iterable E and F.

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

update_values(data, expand=True)[source]

Updates the suffix data given a list of component,value tuples. Provides an improvement in efficiency over calling set_value on every component.

valid_model_component()

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

values() an object providing a view on D's values
property active

Return the active attribute

property ctype

Return the class type for this component

property datatype

Return the suffix datatype.

property direction

Return the suffix direction.

property local_name

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

property name

Get the fully qualified component name.