ScalarBendersCutGenerator

(class from pyomo.contrib.benders.benders_cuts)

class pyomo.contrib.benders.benders_cuts.ScalarBendersCutGenerator(*args, **kwargs)

Bases: ScalarCustomBlockMixin, BendersCutGeneratorData, BendersCutGenerator

__init__(*args, **kwargs)

Constructor

Methods

__init__(*args, **kwargs)

Constructor

activate()

Set the active attribute to True

active_blocks(*args, **kwargs)

DEPRECATED.

active_component_data(*args, **kwargs)

DEPRECATED.

active_components(*args, **kwargs)

DEPRECATED.

add_component(name, val)

Add a component 'name' to the block.

add_subproblem(subproblem_fn, ...[, ...])

all_blocks(*args, **kwargs)

DEPRECATED.

all_component_data(*args, **kwargs)

DEPRECATED.

all_components(*args, **kwargs)

DEPRECATED.

block_data_objects([active, sort, ...])

Returns this block and any matching sub-blocks.

clear()

Clear the data in this component

clear_suffix_value(suffix_or_name[, expand])

Set the suffix value for this component data

clone([memo])

TODO

cname(*args, **kwds)

DEPRECATED.

collect_ctypes([active, descend_into])

Count all component types stored on or under this block.

component(name_or_object)

Return a child component of this block.

component_data_iterindex([ctype, active, ...])

DEPRECATED.

component_data_objects([ctype, active, ...])

Return a generator that iterates through the component data objects for all components in a block.

component_map([ctype, active, sort])

Returns a PseudoMap of the components in this block.

component_objects([ctype, active, sort, ...])

Return a generator that iterates through the component objects in a block.

construct([data])

Initialize the block

contains_component(ctype)

Return True if the component type is in _ctypes and .

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, ostream, prefix])

Print the Pyomo model in a verbose format.

find_component(label_or_component)

Returns a component in the block given a name.

fix_all_vars()

generate_cut()

get_suffix_value(suffix_or_name[, default])

Get the suffix value for this component data

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

Return a string with the component name and index

global_num_subproblems()

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.

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([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 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([sort, ordered])

Return an iterator of (index,data) component data tuples

iteritems()

DEPRECATED.

iterkeys()

DEPRECATED.

itervalues()

DEPRECATED.

keys([sort, ordered])

Return an iterator over the component data keys

local_num_subproblems()

model()

Return the model of the component that owns this data.

parent_block()

Return the parent of the component that owns this data.

parent_component()

Returns the component associated with this object.

pprint([ostream, verbose, prefix])

Print component information

private_data([scope])

reclassify_component_type(name_or_object, ...)

TODO

reconstruct([data])

REMOVED: reconstruct() was removed in Pyomo 6.0.

register_private_data_initializer(initializer)

root_block()

Return self.model()

set_input(root_vars[, tol, comm])

It is very important for root_vars to be in the same order for every process.

set_suffix_value(suffix_or_name, value[, expand])

Set the suffix value for this component data

set_value(val)

Set the value of a scalar component.

to_dense_data()

TODO

transfer_attributes_from(src)

Transfer user-defined attributes from src to this block

type()

DEPRECATED.

unfix_all_vars()

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([sort, ordered])

Return an iterator of the component data objects

write([filename, format, solver_capability, ...])

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

Attributes

active

Return the active attribute

ctype

Return the class type for this component

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

active_blocks(*args, **kwargs)

DEPRECATED.

Deprecated since version 4.1.10486: The active_blocks method is deprecated. Use the Block.block_data_objects() method.

active_component_data(*args, **kwargs)

DEPRECATED.

Deprecated since version 4.1.10486: The active_component_data method is deprecated. Use the Block.component_data_objects() method.

active_components(*args, **kwargs)

DEPRECATED.

Deprecated since version 4.1.10486: The active_components method is deprecated. Use the Block.component_objects() method.

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)

DEPRECATED.

Deprecated since version 4.1.10486: The all_blocks method is deprecated. Use the Block.block_data_objects() method.

all_component_data(*args, **kwargs)

DEPRECATED.

Deprecated since version 4.1.10486: The all_component_data method is deprecated. Use the Block.component_data_objects() method.

all_components(*args, **kwargs)

DEPRECATED.

Deprecated since version 4.1.10486: The all_components method is deprecated. Use the Block.component_objects() method.

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

Returns this block and any matching sub-blocks.

This is roughly equivalent to

iter(block for block in itertools.chain(
     [self], self.component_data_objects(descend_into, ...))
     if block.active == active)

Notes

The self block is always returned, regardless of the types indicated by descend_into.

The active flag is enforced on all blocks, including self.

Parameters:
  • active (None or bool) – If not None, filter components by the active flag

  • sort (None or bool or SortComponents) – Iterate over the components in a specified sorted order

  • descend_into (None or type or iterable) – Specifies the component types (ctypes) to return and to descend into. If True or None, defaults to (Block,). If False, only self is returned.

  • descent_order (None or TraversalStrategy) – The strategy used to walk the block hierarchy. Defaults to TraversalStrategy.PrefixDepthFirstSearch.

Return type:

tuple or generator

clear()

Clear the data in this component

clear_suffix_value(suffix_or_name, expand=True)

Set the suffix value for this component data

clone(memo=None)

TODO

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.

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)

DEPRECATED.

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)

Deprecated since version 6.6.0: The component_data_iterindex method is deprecated. Components now know their index, so it is more efficient to use the Block.component_data_objects() method followed by .index().

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 order

    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.

construct(data=None)

Initialize the block

contains_component(ctype)

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

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='')

Print the Pyomo model in a verbose format.

find_component(label_or_component)

Returns a component in the block given a name.

Parameters:

label_or_component (str, Component, or ComponentUID) – The name of the component to find in this block. String or Component arguments are first converted to ComponentUID.

Returns:

Component on the block identified by the ComponentUID. If a matching component is not found, None is returned.

Return type:

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)

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.

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(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 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(sort=<SortComponents.UNSORTED: 0>, ordered=NOTSET)

Return an iterator of (index,data) component data tuples

Parameters:
  • sort (bool or SortComponents) – Iterate over the declared component items in a specified sorted order. See SortComponents for valid options and descriptions.

  • ordered (bool) – DEPRECATED: Please use sort=SortComponents.ORDERED_INDICES. If True, then the items are returned in a deterministic order (using the underlying set’s ordered_iter().

iteritems()

DEPRECATED.

Return a list (index,data) tuples from the dictionary

Deprecated since version 6.0: The iteritems method is deprecated. Use dict.items().

iterkeys()

DEPRECATED.

Return a list of keys in the dictionary

Deprecated since version 6.0: The iterkeys method is deprecated. Use dict.keys().

itervalues()

DEPRECATED.

Return a list of the component data objects in the dictionary

Deprecated since version 6.0: The itervalues method is deprecated. Use dict.values().

keys(sort=<SortComponents.UNSORTED: 0>, ordered=NOTSET)

Return an iterator over the component data keys

This method sets the ordering of component data objects within this IndexedComponent container. For consistency, __init__(), values(), and items() all leverage this method to ensure consistent ordering.

Parameters:
  • sort (bool or SortComponents) – Iterate over the declared component keys in a specified sorted order. See SortComponents for valid options and descriptions.

  • ordered (bool) – DEPRECATED: Please use sort=SortComponents.ORDERED_INDICES. If True, then the keys are returned in a deterministic order (using the underlying set’s ordered_iter()).

model()

Return the model of the component that owns this data.

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

reclassify_component_type(name_or_object, new_ctype, preserve_declaration_order=True)

TODO

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_input(root_vars, tol=1e-06, comm=None)

It is very important for root_vars to be in the same order for every process.

Parameters:
  • root_vars

  • tol

set_suffix_value(suffix_or_name, value, expand=True)

Set the suffix value for this component data

set_value(val)

Set the value of a scalar component.

to_dense_data()

TODO

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.

type()

DEPRECATED.

Return the class type for this component

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

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(sort=<SortComponents.UNSORTED: 0>, ordered=NOTSET)

Return an iterator of the component data objects

Parameters:
  • sort (bool or SortComponents) – Iterate over the declared component values in a specified sorted order. See SortComponents for valid options and descriptions.

  • ordered (bool) – DEPRECATED: Please use sort=SortComponents.ORDERED_INDICES. If True, then the values are returned in a deterministic order (using the underlying set’s ordered_iter().

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

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

property active

Return the active attribute

property ctype

Return the class type for this component

property local_name

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

property name

Get the fully qualified component name.