High-Level Functions
ProgressiveHedging.solve
— Functionsolve(tree::ScenarioTree,
subproblem_constructor::Function,
r<:Real,
other_args...;
max_iter::Int=1000,
atol::Float64=1e-6,
rtol::Float64=1e-6,
gap_tol::Float64=-1.0,
lower_bound::Int=0,
report::Int=0,
save_iterates::Int=0,
save_residuals::Bool=false,
timing::Bool=true,
warm_start::Bool=false,
callbacks::Vector{Callback}=Vector{Callback}(),
worker_assignments::Dict{Int,Set{ScenarioID}}=Dict{Int,Set{ScenarioID}}(),
args::Tuple=(),
kwargs...)
Solve the stochastic programming problem described by tree
and the models created by subproblem_constructor
using Progressive Hedging.
Arguments
tree::ScenararioTree
: Scenario tree describing the structure of the problem to be solved.subproblem_constructor::Function
: User created function to construct a subproblem. Should accept aScenarioID
(a unique identifier for each scenario subproblem) as an argument and returns a subtype ofAbstractSubproblem
.r<:AbstractPenaltyParameter
: PH penalty parameterother_args
: Other arguments that should be passed tosubproblem_constructor
. See also keyword argumentsargs
andkwargs
.
Keyword Arguments
max_iter::Int
: Maximum number of iterations to perform before returning. Defaults to 1000.atol::Float64
: Absolute error tolerance. Defaults to 1e-6.rtol::Float64
: Relative error tolerance. Defaults to 1e-6.gap_tol::Float64
: Relative gap tolerance. Terminate when the relative gap between the lower bound and objective are smaller thangap_tol
. Any value < 0.0 disables this termination condition. Defaults to -1.0. See also thelower_bound
keyword argument.lower_bound::Int
: Compute and save a lower-bound using (Gade, et. al. 2016) everylower_bound
iterations. Any value <= 0 disables lower-bound computation. Defaults to 0.report::Int
: Print progress to screen everyreport
iterations. Any value <= 0 disables printing. Defaults to 0.save_iterates::Int
: Save PH iterates everysave_iterates
steps. Any value <= 0 disables saving iterates. Defaults to 0.save_residuals::Int
: Save PH residuals everysave_residuals
steps. Any value <= 0 disables saving residuals. Defaults to 0.timing::Bool
: Print timing info after solving if true. Defaults to true.warm_start::Bool
: Flag indicating that solver should be "warm started" by using the previous solution as the starting point (not compatible with all solvers)callbacks::Vector{Callback}
: Collection ofCallback
structs to call after each PH iteration. Callbacks will be executed in the order they appear. SeeCallback
struct for more info. Defaults to empty vector.subproblem_callbacks::Vector{SubproblemCallback}
: Collection ofSubproblemCallback
structs to call before solving each subproblem. Each callback is called on each subproblem but does not affect other subproblems. SeeSubproblemCallback
struct for more info. Defaults to empty vector.worker_assignments::Dict{Int,Set{ScenarioID}}
: Dictionary specifying which scenario subproblems a worker will create and solve. The key values are worker ids as given by Distributed (seeDistributed.workers()
). The user is responsible for ensuring the specified workers exist and that every scenario is assigned to a worker. If no dictionary is given, scenarios are assigned to workers in round robin fashion. Defaults to empty dictionary.args::Tuple
: Tuple of arguments to pass tomodel_cosntructor
. Defaults to (). See alsoother_args
andkwargs
.kwargs
: Any keyword arguments not specified here that need to be passed tosubproblem_constructor
. See alsoother_args
andargs
.
ProgressiveHedging.solve_extensive
— Functionsolve_extensive(tree::ScenarioTree,
subproblem_constructor::Function,
optimizer::Function,
other_args...;
opt_args::NamedTuple=NamedTuple(),
subproblem_type::Type{S}=JuMPSubproblem,
args::Tuple=(),
kwargs...)
Solve given problem using Progressive Hedging.
Arguments
tree::ScenararioTree
: Scenario tree describing the structure of the problem to be solved.subproblem_constructor::Function
: User created function to construct a subproblem. Should accept aScenarioID
(a unique identifier for each scenario subproblem) as an argument and returns a subtype ofAbstractSubproblem
specified bysubproblem_type
.optimizer::Function
: Function which works withJuMP.set_optimizer
other_args
: Other arguments that should be passed tosubproblem_constructor
. See also keyword argumentsargs
andkwargs
Keyword Arguments
subproblem_type<:JuMP.AbstractModel
: Type of model to create or created bysubproblem_constructor
to represent the subproblems. Defaults to JuMPSubproblemopt_args::NamedTuple
: arguments passed to function given byoptimizer
args::Tuple
: Tuple of arguments to pass tomodel_cosntructor
. Defaults to (). See alsoother_args
andkwargs
.kwargs
: Any keyword arguments not specified here that need to be passed tosubproblem_constructor
. See alsoother_args
andargs
.