pybnb.pyomo.range_reduction¶
A Problem interface for implementing parallel range reduction on a PyomoProblem during a branch-and-bound solve.
Copyright by Gabriel A. Hackebeil (gabe.hackebeil@gmail.com).
-
class
pybnb.pyomo.range_reduction.
RangeReductionProblem
(problem, best_objective=None, comm=None)[source]¶ A specialized implementation of the
pybnb.Problem
interface that can be used to perform optimality-based range reduction on a fully implementedPyomoProblem
by defining additional abstract methods.-
listen
(root=0)[source]¶ Listen for requests to run range reduction. All processes within the communicator, except for the root process, should call this method.
Parameters: root (int) – The rank of the process acting as the root. The root process should not call this function.
-
sense
()[source]¶ Returns the objective sense for this problem.
Note
This method is abstract and must be defined by the user.
-
objective
()[source]¶ Returns a feasible value for the objective of the current problem state or
self.infeasible_objective()
if the current state is not feasible.Note
This method is abstract and must be defined by the user.
-
bound
()[source]¶ Returns a value that is a bound on the objective of the current problem state or
self.unbounded_objective()
if no non-trivial bound is available.Note
This method is abstract and must be defined by the user.
-
save_state
(node)[source]¶ Saves the current problem state into the given
pybnb.node.Node
object.This method is guaranteed to be called once at the start of the solve by all processes involved to collect the root node problem state, but it may be called additional times. When it is called for the root node, the
node.tree_depth
will be zero.Note
This method is abstract and must be defined by the user.
-
load_state
(node)[source]¶ Loads the problem state that is stored on the given
pybnb.node.Node
object.Note
This method is abstract and must be defined by the user.
-
branch
()[source]¶ Returns a list of
Node
objects that partition the node state into zero or more children. This method can also be defined as a generator.Note
This method is abstract and must be defined by the user.
-
notify_new_best_node
(node, current)[source]¶ Called when a branch-and-bound solver receives a new best node from the dispatcher. The
Problem
base class provides a default implementation for this method that does nothing.Parameters: - node (
Node
) – The new best node. - current (bool) – Indicates whether or not the node argument is
the currently loaded node (from the most recent
load_state
call).
- node (
-
notify_solve_finished
(comm, worker_comm, results)[source]¶ Called when a branch-and-bound solver finishes. The
Problem
base class provides a default implementation for this method that does nothing.Parameters: - comm (
mpi4py.MPI.Comm
orNone
) – The full MPI communicator that includes all processes. Will be None if MPI has been disabled. - worker_comm (
mpi4py.MPI.Comm
orNone
) – The MPI communicator that includes only worker processes. Will be None if MPI has been disabled. - results (
SolverResults
) – The fully populated results container that will be returned from the solver.
- comm (
-
range_reduction_model_setup
()[source]¶ Called prior to starting range reduction solves to set up the Pyomo model
-
range_reduction_objective_changed
(objective)[source]¶ Called to notify that the range reduction routine has changed the objective
-
range_reduction_constraint_added
(constraint)[source]¶ Called to notify that the range reduction routine has added a constraint
-
range_reduction_constraint_removed
(constraint)[source]¶ Called to notify that the range reduction routine has removed a constraint
-
range_reduction_get_objects
()[source]¶ Called to collect the set of objects over which to perform range reduction solves
-
range_reduction_solve_for_object_bound
(x)[source]¶ Called to perform a range reduction solve for a Pyomo model object
-