API Documentation
API Manual
PlasmoBenders.AbstractPBAlgorithm
— TypeAbstractPBAlgorithm{T}
PlasmoBenders.BendersAlgorithm
— TypeBendersAlgorithm
Optimizer object for dual dynamic programming with graphs. Currently only implemented for linear tree structures.
Attributes include the following (where noted as dictionaries, these are mappings from the Benders subproblems to the data described)
graph
- Plasmo OptiGraph for appplying Bendersroot_object
- node or subgraph ingraph
indicating where to start the Benders algorithmis_MIP
= Boolean indicating if the problem is a MIP or notsolve_order
- vector of OptiNodes in the order that they are solved by Benderssolve_order_dict
- dictionary mapping to a vector of all the "next objects" for a given objectparent_objects
- dictionary mapping to the previous subproblemmax_iters
- maximum number of Benders iterationstime_limit
- maximum time (seconds) allowed for running Benderstol
- (absolute) termination tolerance between upper and lower boundscurrent_iter
- current iteration of Benders algorithmM
- lower bound for the cost-to-go function at each iterationdual_iters
- dictionary mapping optinodes to the corresponding dual values at each iteration; dual values come from solution of following nodeprimal_iters
- dictionary mapping optinodes to the primal solutions of the complicating variables on the given nodephis
- dictionary mapping optinodes to the objective of the immediately following nodephis_LR
- dictionary mapping optinodes to the objective of the lagrangean (used for strenghtened cuts) relaxation of the following node; used for strengthened Benders cuts in MIPstime_forward_pass
- time spent in the forward pass (seconds)time_backward_pass
- time spent in the backward pass (seconds)time_init
- time initializing the optimizer (seconds)time_iterations
- vector of the times spent in each Iterationcomp_vars
- dictionary mapping the node to a vector of its complicating variablescomp_var_map
- dictionary mapping the node to a dictionary of complicating variables mapped to their index incomp_vars
var_copy_map
- dictionary mapping the node to a dictionary mapping the complicating variables to their copies on the following nodeobjective_value
- the final objective value (from upper bound)lower_bounds
- vector of lower bounds at each iterationupper_bounds
- vector of upper bounds at each iterationregularize_data
- regularization data objectbinary_map
- dictionary mapping the nodes to a vector of binary variables on the nodeinteger_map
- dictionary mapping the nodes to a vector of integer variables on the nodelast_solutions
- dictionary mapping the nodes to a vector of the last solutionsvar_solution_map
- dictionary mapping the variables to their index on thelast_solutions
vectorvar_to_graph_map
- dictionary mapping the variables to their owning subproblem subgraphfeasibility_map
- dictionary matchingsolve_order
for whether a problem was feasible or notoptions
- solver options for Benders algorithmext
- Dictionary for extending certain procedures
PlasmoBenders.BendersAlgorithm
— MethodBendersAlgorithm(graph, root_object; kwargs...)
Function for creating the BendersAlgorithm object from graph
. root_object
must be an OptiNode or subgraph on graph
. key ward arguments include the following
max_iters = 100
- maximum number of iterationstol = 1e-7
- termination tolerance between upper and lower boundsM = 0
- lower bound on cost-to-go estimator for each nodeis_MIP = nothing
- indicates if the problem is a MIP. If it is passed asnothing
, PlasmoBenders will check to see if it is a MIP, and will setis_MIP
accordinglysolver = nothing
- if defined, this solver will be set for all subproblemsstrengthened = false
- whether to use strengthened Benders cuts (see https://doi.org/10.1007/s10107-018-1249-5.)multicut = true
- whether to use multicuts (rather than aggregated cuts) when applicablefeasibility_cuts = false
- whether to allow feasibility cutsregularize = false
- whether to regularize solution of next iteratesparallelize_benders = false
- whether to parallelize subproblem solution when the problem has a Benders-type structure definedparallelize_forward = false
- whether to parallelize forward pass if possible; not yet supportedparallelize_backward = false
- whether to parallelize backward passadd_slacks::Bool = false
- whether to add slack variables to the linking constraints to help ensure feasibility between solutions; slack variables are penalized in objectivefix_slacks = false
- whether to fix the slack variables to zero they only relax if a problem is infeasiblewarm_start::Bool = true
- whether to set the previous iterations solutions as the starting values for the next iterations forward passrelaxed_init_cuts = false
- whether to generate initial cuts by relaxing the problem and solving the whole problem; only applies for MILPsslack_penalty = 1e6
- coefficient on slack variables in objectiveregularize_param = 0.5
- regularization parameter; must be between 0 and 1
PlasmoBenders.BendersOptions
— TypeBendersOptions
Options object for dual dynamic programming with graphs
Attributes include
strengthened::Bool
- whether to use strengthened cutsmulticut::Bool
- whether the problem should use aggregated or multiple cuts when there are multiple objects generating information in the forward passfeasibility_cuts::Bool
- whether to allow feasibility cuts if infeasibleregularize::Bool
- whether to used regularization for getting next cutsparallelize_benders::Bool
- whether to parallelize Benders problems if applicableparallelize_forward::Bool
- whether to parallelize the forward pass if possibleparallelize_backward::Bool
- whether to parallelize the backward pass if possibleadd_slacks::Bool
- whether to add slack variables to linking constraintsfix_slacks::Bool
- whether to fix the slack variables to zero; slacks will be relaxed if the problem is infeasiblewarm_start::Bool
- whether to warm start the problem using the previous best solutionrelaxed_init_cuts::Bool
- whether to create some initial cuts by relaxing the problem and solving the full problem as an LP; only applies if the problem is a MIPslack_penalty::Real
- penalty for nonzero slacks; only applies foradd_slacks = true
regularize_param::Real
- parameter for regularization; essentially how far from optimal the solution can end up being for choosing the next iterates.
PlasmoBenders.RegularizeData
— TypeRegularizeData
Data structure for storing regularization data
All attributes include a dictionary which is indexed by the subproblem objects of Benders
objective_function
- the objective function of an objectubs
- value of the object's objective (without theta)lbs
- value of the object's objective (with theta)best_ub
- best upper bound
JuMP.value
— MethodJuMP.value(opt::BendersAlgorithm, var::NodeVariableRef)
Returns the value of var
from the BendersAlgorithm object. The value corresponds to the best upper bound of the optimizer.
JuMP.value
— MethodJuMP.value(opt::BendersAlgorithm, vars::Vector{NodeVariableRef})
Returns a vector of variables contained in the vars
vector from the BendersAlgorithm object. The values correspond to the best upper bound of the optimizer.
PlasmoBenders._add_Benders_cuts!
— Method_add_Benders_cuts!(optimizer::BendersAlgorithm)
Add Benders cuts to each nested problem; uses results from the backward pass and forward pass to create cuts.
PlasmoBenders._add_initial_relaxed_cuts!
— Method_add_initial_relaxed_cuts!(optimizer::BendersAlgorithm)
PlasmoBenders._add_strengthened_cuts!
— Method_add_strengthened_cuts!(optimizer::BendersAlgorithm)
Add strengthened Benders cuts to each nested problem; Follows the process described by Zou et al., 2019 (https://doi.org/10.1007/s10107-018-1249-5) where the cuts come from a Lagrangian relaxation where the lagrange multipliers are the dual variables of the backward pass.
PlasmoBenders._backward_pass!
— Method_backward_pass!(optimizer::BendersAlgorithm)
Perform backward pass for a MIP problem. Backward pass can be done in parallel. Binary and integer variables are relaxed and the problem is solved to get the dual and objective values for producing Benders cuts. If strengthened = true
, the stengthened cuts are ALSO added using the approach of Zou et al. https://doi.org/10.1007/s10107-018-1249-5.
PlasmoBenders._forward_pass!
— Method_forward_pass!(optimizer::BendersAlgorithm)
Runs the forward pass for Benders. Follows the node order in solve_order
attribute. Save the primal information for complicating variables on each node. If it is not a MIP, also saves the dual and objective value information and adds the Benders cut. Returns the upper and lower bounds, where lower bound is only valid if the problem is not a MIP (otherwise the lower bound comes from the backward pass)
PlasmoBenders.get_add_slacks
— Methodget_add_slacks(optimizer::BendersAlgorithm)
Return the value of add_slacks from the options
field of the BendersAlgorithm
PlasmoBenders.get_feasibility_cuts
— Methodget_feasibility_cuts(optimizer::BendersAlgorithm)
Return the value of feasibility_cuts from the options
field of the BendersAlgorithm
PlasmoBenders.get_fix_slacks
— Methodget_fix_slacks(optimizer::BendersAlgorithm)
Return the value of fix_slacks from the options
field of the BendersAlgorithm
PlasmoBenders.get_graph
— Methodget_graph(optimizer::BendersAlgorithm)
Return the value of the graph attribute from the BendersAlgorithm
PlasmoBenders.get_is_MIP
— Methodget_is_MIP(optimizer::BendersAlgorithm)
Return the value of the is_MIP attribute from the BendersAlgorithm
PlasmoBenders.get_lower_bounds
— Methodget_lower_bounds(optimizer::BendersAlgorithm)
Return the value of the lower_bounds attribute from the BendersAlgorithm
PlasmoBenders.get_max_iters
— Methodget_max_iters(optimizer::BendersAlgorithm)
Return the value of the max_iters attribute from the BendersAlgorithm
PlasmoBenders.get_multicut
— Methodget_multicut(optimizer::BendersAlgorithm)
Return the value of multicut from the options
field of the BendersAlgorithm
PlasmoBenders.get_parallelize_backward
— Methodget_parallelize_backward(optimizer::BendersAlgorithm)
Return the value of parallelize_backward from the options
field of the BendersAlgorithm
PlasmoBenders.get_parallelize_benders
— Methodget_parallelize_benders(optimizer::BendersAlgorithm)
Return the value of parallelize_benders from the options
field of the BendersAlgorithm
PlasmoBenders.get_parallelize_forward
— Methodget_parallelize_forward(optimizer::BendersAlgorithm)
Return the value of parallelize_forward from the options
field of the BendersAlgorithm
PlasmoBenders.get_regularize
— Methodget_regularize(optimizer::BendersAlgorithm)
Return the value of regularize from the options
field of the BendersAlgorithm
PlasmoBenders.get_regularize_best_ub
— Methodget_regularize_best_ub(optimizer::BendersAlgorithm)
Return the value of bestub from the `regularizedatafield of the
BendersAlgorithm`
PlasmoBenders.get_regularize_constraint
— Methodget_regularize_constraint(optimizer::BendersAlgorithm)
Return the value of constraint from the regularize_data
field of the BendersAlgorithm
PlasmoBenders.get_regularize_lbs
— Methodget_regularize_lbs(optimizer::BendersAlgorithm)
Return the value of lbs from the regularize_data
field of the BendersAlgorithm
PlasmoBenders.get_regularize_objective_function
— Methodget_regularize_objective_function(optimizer::BendersAlgorithm)
Return the value of objectivefunction from the `regularizedatafield of the
BendersAlgorithm`
PlasmoBenders.get_regularize_param
— Methodget_regularize_param(optimizer::BendersAlgorithm)
Return the value of regularize_param from the options
field of the BendersAlgorithm
PlasmoBenders.get_regularize_slack
— Methodget_regularize_slack(optimizer::BendersAlgorithm)
Return the value of slack from the regularize_data
field of the BendersAlgorithm
PlasmoBenders.get_regularize_ubs
— Methodget_regularize_ubs(optimizer::BendersAlgorithm)
Return the value of ubs from the regularize_data
field of the BendersAlgorithm
PlasmoBenders.get_relaxed_init_cuts
— Methodget_relaxed_init_cuts(optimizer::BendersAlgorithm)
Return the value of relaxedinitcuts from the options
field of the BendersAlgorithm
PlasmoBenders.get_root_object
— Methodget_root_object(optimizer::BendersAlgorithm)
Return the value of the root_object attribute from the BendersAlgorithm
PlasmoBenders.get_slack_penalty
— Methodget_slack_penalty(optimizer::BendersAlgorithm)
Return the value of slack_penalty from the options
field of the BendersAlgorithm
PlasmoBenders.get_strengthened
— Methodget_strengthened(optimizer::BendersAlgorithm)
Return the value of strengthened from the options
field of the BendersAlgorithm
PlasmoBenders.get_time_backward_pass
— Methodget_time_backward_pass(optimizer::BendersAlgorithm)
Return the value of the timebackwardpass attribute from the BendersAlgorithm
PlasmoBenders.get_time_forward_pass
— Methodget_time_forward_pass(optimizer::BendersAlgorithm)
Return the value of the timeforwardpass attribute from the BendersAlgorithm
PlasmoBenders.get_time_init
— Methodget_time_init(optimizer::BendersAlgorithm)
Return the value of the time_init attribute from the BendersAlgorithm
PlasmoBenders.get_time_iterations
— Methodget_time_iterations(optimizer::BendersAlgorithm)
Return the value of the time_iterations attribute from the BendersAlgorithm
PlasmoBenders.get_time_limit
— Methodget_time_limit(optimizer::BendersAlgorithm)
Return the value of the time_limit attribute from the BendersAlgorithm
PlasmoBenders.get_tol
— Methodget_tol(optimizer::BendersAlgorithm)
Return the value of the tol attribute from the BendersAlgorithm
PlasmoBenders.get_upper_bounds
— Methodget_upper_bounds(optimizer::BendersAlgorithm; monotonic = true)
Return the value of upper_bounds
from the BendersAlgorithm
object. This is a vector of the upper bounds at each iteration. The upper bound returned by each iteration is not guaranteed to decrease monotonically. If monotonic=true
, this function returns the best upper bound seen up to each iteration (rather than the value of the feasible solution seen at that iteration)
PlasmoBenders.get_warm_start
— Methodget_warm_start(optimizer::BendersAlgorithm)
Return the value of warm_start from the options
field of the BendersAlgorithm
PlasmoBenders.run_algorithm!
— Methodrun_algorithm!(optimizer::PB.BendersAlgorithm; output::Bool = true, run_gc::Bool = false)
Optimize the graph in BendersAlgorithm by using the Benders algorithm. Keyword argument output
indicates whether to print the upper/lower bounds and gap and each iteraiton. run_gc
indicates whether to run the garbage collector after each iteraiton.
PlasmoBenders.set_add_slacks!
— Methodset_add_slacks!(optimizer::BendersAlgorithm, val::Bool)
Set the value of add_slacks from the options
field of the BendersAlgorithm
to val
PlasmoBenders.set_feasibility_cuts!
— Methodset_feasibility_cuts!(optimizer::BendersAlgorithm, val::Bool)
Set the value of feasibility_cuts from the options
field of the BendersAlgorithm
to val
PlasmoBenders.set_fix_slacks!
— Methodset_fix_slacks!(optimizer::BendersAlgorithm, val::Bool)
Set the value of fix_slacks from the options
field of the BendersAlgorithm
to val
PlasmoBenders.set_multicut!
— Methodset_multicut!(optimizer::BendersAlgorithm, val::Bool)
Set the value of multicut from the options
field of the BendersAlgorithm
to val
PlasmoBenders.set_parallelize_backward!
— Methodset_parallelize_backward!(optimizer::BendersAlgorithm, val::Bool)
Set the value of parallelize_backward from the options
field of the BendersAlgorithm
to val
PlasmoBenders.set_parallelize_benders!
— Methodset_parallelize_benders!(optimizer::BendersAlgorithm, val::Bool)
Set the value of parallelize_benders from the options
field of the BendersAlgorithm
to val
PlasmoBenders.set_parallelize_forward!
— Methodset_parallelize_forward!(optimizer::BendersAlgorithm, val::Bool)
Set the value of parallelize_forward from the options
field of the BendersAlgorithm
to val
PlasmoBenders.set_regularize!
— Methodset_regularize!(optimizer::BendersAlgorithm, val::Bool)
Set the value of regularize from the options
field of the BendersAlgorithm
to val
PlasmoBenders.set_regularize_param!
— Methodset_regularize_param!(optimizer::BendersAlgorithm, val::Real)
Set the value of regularize_param from the options
field of the BendersAlgorithm
to val
PlasmoBenders.set_relaxed_init_cuts!
— Methodset_relaxed_init_cuts!(optimizer::BendersAlgorithm, val::Bool)
Set the value of relaxedinitcuts from the options
field of the BendersAlgorithm
to val
PlasmoBenders.set_slack_penalty!
— Methodset_slack_penalty!(optimizer::BendersAlgorithm, val::Real)
Set the value of slack_penalty from the options
field of the BendersAlgorithm
to val
PlasmoBenders.set_strengthened!
— Methodset_strengthened!(optimizer::BendersAlgorithm, val::Bool)
Set the value of strengthened from the options
field of the BendersAlgorithm
to val
PlasmoBenders.set_warm_start!
— Methodset_warm_start!(optimizer::BendersAlgorithm, val::Bool)
Set the value of warm_start from the options
field of the BendersAlgorithm
to val