Low-Level Functions
ProgressiveHedging.add_leaf
ProgressiveHedging.add_node
ProgressiveHedging.apply_to_subproblem
ProgressiveHedging.branch_value
ProgressiveHedging.cb
ProgressiveHedging.consensus_variables
ProgressiveHedging.convert_to_variable_ids
ProgressiveHedging.convert_to_xhat_id
ProgressiveHedging.get_callback
ProgressiveHedging.get_callback_ext
ProgressiveHedging.index
ProgressiveHedging.is_integer
ProgressiveHedging.is_leaf
ProgressiveHedging.leaf_value
ProgressiveHedging.lower_bounds
ProgressiveHedging.mean_deviation
ProgressiveHedging.name
ProgressiveHedging.print_timing
ProgressiveHedging.probability
ProgressiveHedging.residuals
ProgressiveHedging.retrieve_aug_obj_value
ProgressiveHedging.retrieve_no_hat_history
ProgressiveHedging.retrieve_no_hats
ProgressiveHedging.retrieve_obj_value
ProgressiveHedging.retrieve_soln
ProgressiveHedging.retrieve_w
ProgressiveHedging.retrieve_w_history
ProgressiveHedging.retrieve_xhat_history
ProgressiveHedging.root
ProgressiveHedging.scenario
ProgressiveHedging.scenario_bundle
ProgressiveHedging.scenario_tree
ProgressiveHedging.scenarios
ProgressiveHedging.scid
ProgressiveHedging.spcb
ProgressiveHedging.stage
ProgressiveHedging.stage_id
ProgressiveHedging.stid
ProgressiveHedging.two_stage_tree
ProgressiveHedging.value
ProgressiveHedging.value
ProgressiveHedging.value
ProgressiveHedging.value
ProgressiveHedging.value
ProgressiveHedging.value
ProgressiveHedging.value
ProgressiveHedging.variable_fixing
ProgressiveHedging.variables
ProgressiveHedging.w_value
ProgressiveHedging.xhat_value
Callback Creation and Retrieval
ProgressiveHedging.apply_to_subproblem
— Functionapply_to_subproblem(to_apply::Function,
phd::PHData,
winf::WorkerInf,
scid::ScenarioID,
args::Tuple=(),
kwargs::NamedTuple=NamedTuple(),
)
Applies the function to_apply
to the subproblem with scenario id scid
.
ProgressiveHedging.cb
— Functioncb(f::Function)
cb(f::Function, ext::Dict{Symbol,Any})
cb(f::Function, initialize::Function)
cb(f::Function, initialize::Function, ext::Dict{Symbol,Any})
cb(name::String, f::Function, ext::Dict{Symbol,Any})
Shorthand for Callback
functions with the same signature.
ProgressiveHedging.get_callback
— Functionget_callback(phd::PHData, name::String)::Callback
Retrieve the callback with name name
.
ProgressiveHedging.get_callback_ext
— Functionget_callback_ext(phd::PHData, name::String)::Dict{Symbol,Any}
Retrieve the external dictionary for callback name
.
ProgressiveHedging.mean_deviation
— Functionmean_deviation(;tol::Float64=1e-8,
save_deviations::Bool=false
)::Callback
Implementation of a termination criterion given in section 2.3 of (Watson & Woodruff 2010). There it is called 'td'.
ProgressiveHedging.spcb
— Functionspcb(f::Function)
spcb(f::Function, ext::Dict{Symbol,Any})
spcb(name::String, f::Function, ext::Dict{Symbol,Any})
Shorthand for SubproblemCallback
.
ProgressiveHedging.variable_fixing
— Functionvariable_fixing(; lag=2, eq_tol=1e-8)::Callback
Implementation of the variable fixing convergence acceleration heuristic in section 2.2 of (Watson & Woodruff 2010).
ID Type Interactions
ProgressiveHedging.convert_to_variable_ids
— Functionconvert_to_variable_ids(phd::PHData, xid::XhatID)::Set{VariableID}
Convert the given consensus variable id to the contributing individual subproblem variable ids.
Arguments
phd::PHData
: PH data structure for the corresponding problemxid::XhatID
: consensus variable id to convert
ProgressiveHedging.convert_to_xhat_id
— Functionconvert_to_xhat_id(phd::PHData, vid::VariableID)::XhatID
Convert the given VariableID
to the consensus variable id (XhatID
).
Arguments
phd::PHData
: PH data structure for the corresponding problemvid::VariableID
: variable id to convert
ProgressiveHedging.index
— Functionindex(vid::VariableID)::Index
Returns the Index
of the specified VariableID
.
index(n::Int64)::Index
Create Index
from n
.
ProgressiveHedging.scenario
— Functionscenario(vid::VariableID)::ScenarioID
Returns the ScenarioID
of the specified VariableID
.
ProgressiveHedging.scid
— Functionscid(n::Int64)::ScenarioID
Create ScenarioID
from n
.
ProgressiveHedging.stage
— Functionstage(vid::VariableID)::StageID
Returns the StageID
of the specified VariableID
.
ProgressiveHedging.stage_id
— Functionstage_id(phd::PHData, xid::XhatID)::StageID
Returns the StageID
in which the given consensus variable is.
ProgressiveHedging.stid
— Functionstid(n::Int64)::StageID
Create StageID
from n
.
ProgressiveHedging.value
— Methodvalue(idx::Index)
Return the raw (non-type safe) value of an Index
ProgressiveHedging.value
— Methodvalue(nid::NodeID)
Return the raw (non-type safe) value of a NodeID
ProgressiveHedging.value
— Methodvalue(scid::ScenarioID)
Return the raw (non-type safe) value of a ScenarioID
ProgressiveHedging.value
— Methodvalue(stid::StageID)
Return the raw (non-type safe) value of a StageID
Result Retrieval
ProgressiveHedging.lower_bounds
— Functionlower_bounds(phd::PHData)::DataFrames.DataFrame
Return a DataFrame
with the computed and saved lower bounds. See the lower_bound
keyword argument on solve
.
ProgressiveHedging.print_timing
— Functionprint_timing([io::IO], phd::PHData)
Prints timining information from the Progressive Hedging solve.
ProgressiveHedging.residuals
— Functionresiduals(phd::PHData)::DataFrames.DataFrame
Return a DataFrame
with absolute and relative residuals along with the components. See the save_residuals
keyword argument on solve
.
ProgressiveHedging.retrieve_soln
— Functionretrieve_soln(phd::PHData)::DataFrames.DataFrame
Return a DataFrame
with the solution values of all consensus and leaf variables.
ProgressiveHedging.retrieve_aug_obj_value
— Functionretrieve_aug_obj_value(phd::PHData)::Float64
Return the current objective value including Lagrange and proximal PH terms of the stochastic program.
ProgressiveHedging.retrieve_obj_value
— Functionretrieve_obj_value(phd::PHData)::Float64
Return the current objective value without Lagrange and proximal PH terms.
ProgressiveHedging.retrieve_no_hats
— Functionretrieve_no_hats(phd::PHData)::DataFrames.DataFrame
Return a DataFrame
with the final nonconsensus variable values.
ProgressiveHedging.retrieve_no_hat_history
— Functionretrieve_no_hat_history(phd::PHData)::DataFrames.DataFrame
Return a DataFrame
with the saved nonconsensus variable values. See the save_iterates
keyword argument on solve
.
ProgressiveHedging.retrieve_w
— Functionretrieve_w(phd::PHData)::DataFrames.DataFrame
Return a DataFrame
with the final anticipativity constraint Lagrange multiplier values.
ProgressiveHedging.retrieve_w_history
— Functionretrieve_w_history(phd::PHData)::DataFrames.DataFrame
Return a DataFrame
with the saved PH Lagrange variable values. See the save_iterates
keyword argument on solve
.
ProgressiveHedging.retrieve_xhat_history
— Functionretrieve_xhat_history(phd::PHData)::DataFrames.DataFrame
Return a DataFrame
with the saved consensus variable values. See the save_iterates
keyword argument on solve
.
Problem Accessors
ProgressiveHedging.probability
— Functionprobability(phd::PHData, scenario::ScenarioID)::Float64
Returns the probability of the given scenario.
ProgressiveHedging.scenario_tree
— Functionscenario_tree(phd::PHData)::ScenarioTree
Returns the scenario tree for created stochastic programming problem.
ProgressiveHedging.scenarios
— Functionscenarios(phd::PHData)::Set{ScenarioID}
Returns the set of all scenarios for the stochastic problem.
Scenario Tree
ProgressiveHedging.add_node
— Functionadd_node(tree::ScenarioTree, parent::ScenarioNode)
Add a node to the ScenarioTree tree
with parent node parent
. Return the added node. If the node to add is a leaf, use add_leaf
instead.
ProgressiveHedging.add_leaf
— Functionadd_leaf(tree::ScenarioTree, parent::ScenarioNode, probability<:Real)
Add a leaf to the ScenarioTree tree
with parent node parent
. The probability of this scenario occuring is given by probability
. Returns the ScenarioID representing the scenario.
ProgressiveHedging.root
— Functionroot(tree::ScenarioTree)
Return the root node of the given ScenarioTree
ProgressiveHedging.two_stage_tree
— Functiontwo_stage_tree(n::Int)::ScenarioTree
two_stage_tree(p::Vector{R})::ScenarioTree where R <: Real
Construct and return a two-stage scenario tree with n
scenarios with equal probability or a two-stage scenario tree with length(p)
scenarios where probability of scenario s is p[s+1]
.
Variable Interactions
ProgressiveHedging.branch_value
— Functionbranch_value(phd::PHData, vid::VariableID)::Float64
Returns the value of the variable associated with vid
. Must be a branch variable.
See also: leaf_value
, value
branch_value(phd::PHData, scen::ScenarioID, stage::StageID, idx::Index)::Float64
Returns the value of the variable associated with with scenario scen
, stage stage
and index idx
. Must be a branch variable.
See also: leaf_value
, value
ProgressiveHedging.consensus_variables
— Functionconsensus_variables(phd::PHData)::Dict{XhatID,HatVariable}
Returns the collection of consensus variables for the problem.
ProgressiveHedging.is_integer
— Functionis_integer(a::HatVariable)::Bool
Returns true if the consensus variable is an integer variable. The consensus variable is an integer if the contributing subproblem variables are all integer variables.
ProgressiveHedging.is_leaf
— Functionis_leaf(phd::PHData, xhid::XhatID)::Bool
Returns true if the given consensus variable id belongs to a leaf vertex in the scenario tree.
ProgressiveHedging.leaf_value
— Functionleaf_value(phd::PHData, vid::VariableID)::Float64
leaf_value(phd::PHData, scen::ScenarioID, stage::StageID, idx::Index)::Float64
Returns the value of the variable associated with vid
or with scenario scen
, stage stage
and index idx
. Must be a leaf variable.
WARNING: For computational efficiency, leaf values are collected only at the end of a PH run. Therefore, using this function in a callback will result in an error.
See also: branch_value
, value
ProgressiveHedging.name
— Functionname(phd::PHData, vid::VariableID)::String
Returns the name of the consensus variable for the given VariableID
.
name(phd::PHData, xid::XhatID)::String
Returns the name of the consensus variable for the given XhatID
. The name is the same given to the individual scenario variables.
ProgressiveHedging.scenario_bundle
— Functionscenario_bundle(phd::PHData, xid::XhatID)::Set{ScenarioID}
Returns the scenarios contributing to the consensus variable associated with xid
.
ProgressiveHedging.value
— Methodvalue(a::HatVariable)::Float64
Returns the current value of a
.
ProgressiveHedging.value
— Methodvalue(phd::PHData, vid::VariableID)
Returns the value of the variable associated with vid
.
See also: branch_value
, leaf_value
ProgressiveHedging.value
— Methodvalue(phd::PHData, scen::ScenarioID, stage::StageID, idx::Index)::Float64
Returns the value of the variable associated with scenario scen
, stage stage
and index idx
.
See also: branch_value
, leaf_value
ProgressiveHedging.variables
— Functionvariables(a::HatVariable)::Set{VariableID}
Returns the variable ids for all subproblem variables contributing to this variable.
ProgressiveHedging.w_value
— Functionw_value(phd::PHData, vid::VariableID)
Returns the value of the variable associated with vid
. Only available for branch variables.
w_value(phd::PHData, scen::ScenarioID, stage::StageID, idx::Index)::Float64
Returns the value of the variable associated with scenario scen
, stage stage
and index idx
. Only available for branch variables.
ProgressiveHedging.xhat_value
— Functionxhat_value(phd::PHData, xhid::VariableID)::Float64
Returns the value of the consensus variable associated with xhid
. Only available for leaf variables after calling solve
. Available for branch variables at any time.
xhat_value(phd::PHData, vid::VariableID)::Float64
Returns the value of the consensus variable associated with vid
. Only available for leaf variables after calling solve
. Available for branch variables at any time.
xhat_value(phd::PHData, scen::ScenarioID, stage::StageID, idx::Index)::Float64
Returns the value of the consensus variable associated with scenario scen
, stage stage
and index idx
. Only available for leaf variables after calling solve
. Available for branch variables at any time.