piecewise_dlog

(class from pyomo.core.kernel.piecewise_library.transforms)

class pyomo.core.kernel.piecewise_library.transforms.piecewise_dlog(*args, **kwds)[source]

Bases: TransformedPiecewiseLinearFunction

Discrete DLOG piecewise representation

Expresses a piecewise linear function using the DLOG formulation. This formulation uses logarithmic number of discrete variables in terms of number of breakpoints.

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

Methods

__init__(*args, **kwds)

activate([shallow])

Activate this container.

block_data_objects(**kwds)

child(key)

Get the child object associated with a given storage key for this container.

child_ctypes()

Returns the set of child object category types stored in this container.

children([ctype])

Iterate over the children of this block.

clone()

Returns a copy of this object with the parent pointer set to None.

collect_ctypes([active, descend_into])

Returns the set of object category types that can be found under this container.

component_data_objects(*args, **kwds)

component_objects(*args, **kwds)

components([ctype, active, descend_into])

Generates an efficient traversal of all components stored under this container.

deactivate([shallow])

Deactivate this container.

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

Dynamically generates a name for this object.

load_solution(solution[, ...])

Load a solution.

valid_problem_types()

validate(**kwds)

Validate this piecewise linear function by verifying various properties of the breakpoints, values, and input variable (e.g., that the list of breakpoints is nondecreasing).

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

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

Attributes

active

The active status of this object.

bound

The bound type assigned to the piecewise relationship ('lb','ub','eq').

breakpoints

The set of breakpoints used to defined this function

ctype

The object's category type.

input

The expression that stores the input to the piecewise function.

local_name

The object's local name within the context of its parent.

name

The object's fully qualified name.

output

The expression that stores the output of the piecewise function.

parent

The object's parent (possibly None).

storage_key

The object's storage key within its parent

values

The set of values used to defined this function

Member Documentation

activate(shallow=True)

Activate this container.

child(key)

Get the child object associated with a given storage key for this container.

Raises:

KeyError – if the argument is not a storage key for any children of this container

child_ctypes()

Returns the set of child object category types stored in this container.

children(ctype=<class 'pyomo.core.kernel.base._no_ctype'>)

Iterate over the children of this block.

Parameters:

ctype – Indicates the category of children to include. The default value indicates that all categories should be included.

Returns:

iterator of child objects

clone()

Returns a copy of this object with the parent pointer set to None.

A clone is almost equivalent to deepcopy except that any categorized objects encountered that are not descendents of this object will reference the same object on the clone.

collect_ctypes(active=True, descend_into=True)

Returns the set of object category types that can be found under this container.

Parameters:
  • active (True/None) – Controls whether or not to filter the iteration to include only the active part of the storage tree. The default is True. Setting this keyword to None causes the active status of objects to be ignored.

  • descend_into (bool, function) – Indicates whether or not to descend into a heterogeneous container. Default is True, which is equivalent to lambda x: True, meaning all heterogeneous containers will be descended into.

Returns:

A set of object category types

components(ctype=<class 'pyomo.core.kernel.base._no_ctype'>, active=True, descend_into=True)

Generates an efficient traversal of all components stored under this container. Components are categorized objects that are either (1) not containers, or (2) are heterogeneous containers.

Parameters:
  • ctype – Indicates the category of components to include. The default value indicates that all categories should be included.

  • active (True/None) – Controls whether or not to filter the iteration to include only the active part of the storage tree. The default is True. Setting this keyword to None causes the active status of objects to be ignored.

  • descend_into (bool, function) – Indicates whether or not to descend into a heterogeneous container. Default is True, which is equivalent to lambda x: True, meaning all heterogeneous containers will be descended into.

Returns:

iterator of components in the storage tree

deactivate(shallow=True)

Deactivate this container.

getname(fully_qualified=False, name_buffer={}, convert=<class 'str'>, relative_to=None)

Dynamically generates a name for this object.

Parameters:
  • fully_qualified (bool) – Generate a full name by iterating through all ancestor containers. Default is False.

  • convert (function) – A function that converts a storage key into a string representation. Default is the built-in function str.

  • relative_to (object) – When generating a fully qualified name, generate the name relative to this block.

Returns:

If a parent exists, this method returns a string representing the name of the object in the context of its parent; otherwise (if no parent exists), this method returns None.

load_solution(solution, allow_consistent_values_for_fixed_vars=False, comparison_tolerance_for_fixed_vars=1e-05)

Load a solution.

Parameters:
  • solution – A pyomo.opt.Solution object with a symbol map. Optionally, the solution can be tagged with a default variable value (e.g., 0) that will be applied to those variables in the symbol map that do not have a value in the solution.

  • allow_consistent_values_for_fixed_vars – Indicates whether a solution can specify consistent values for variables that are fixed.

  • comparison_tolerance_for_fixed_vars – The tolerance used to define whether or not a value in the solution is consistent with the value of a fixed variable.

validate(**kwds)[source]

Validate this piecewise linear function by verifying various properties of the breakpoints, values, and input variable (e.g., that the list of breakpoints is nondecreasing).

See base class documentation for keyword descriptions.

write(filename, format=None, _solver_capability=None, _called_by_solver=False, **kwds)

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

Parameters:
  • filename (str) – The name of the file to write.

  • format – The file format to use. If this is not specified, the file format will be inferred from the filename suffix.

  • **kwds – Additional keyword options passed to the model writer.

Returns:

a SymbolMap

property active

The active status of this object.

property bound

The bound type assigned to the piecewise relationship (‘lb’,’ub’,’eq’).

property breakpoints

The set of breakpoints used to defined this function

property ctype

The object’s category type.

property input

The expression that stores the input to the piecewise function. The returned object can be updated by assigning to its expr attribute.

property local_name

The object’s local name within the context of its parent. Alias for obj.getname(fully_qualified=False).

property name

The object’s fully qualified name. Alias for obj.getname(fully_qualified=True).

property output

The expression that stores the output of the piecewise function. The returned object can be updated by assigning to its expr attribute.

property parent

The object’s parent (possibly None).

property storage_key

The object’s storage key within its parent

property values

The set of values used to defined this function