API
TwoStageSpanningTree.TwoStageSpanningTreeInstanceTwoStageSpanningTree.TwoStageSpanningTreeSolutionTwoStageSpanningTree.MILP_separation_problemTwoStageSpanningTree.anticipative_solutionTwoStageSpanningTree.benders_decompositionTwoStageSpanningTree.column_generationTwoStageSpanningTree.column_heuristicTwoStageSpanningTree.cut_generationTwoStageSpanningTree.cut_separation_problemTwoStageSpanningTree.is_feasibleTwoStageSpanningTree.kruskalTwoStageSpanningTree.lagrangian_relaxationTwoStageSpanningTree.nb_scenariosTwoStageSpanningTree.plot_grid_graphTwoStageSpanningTree.plot_scenarioTwoStageSpanningTree.solution_from_first_stage_forestTwoStageSpanningTree.solution_value
TwoStageSpanningTree.TwoStageSpanningTreeInstance — Typestruct TwoStageSpanningTreeInstance{T}Fields
graph::Graphs.SimpleGraphs.SimpleGraph{Int64}: Graphfirst_stage_costs::Vector: First stage costs for each edgesecond_stage_costs::Matrix: Second stage costs for each edge and scenario [e, s]
TwoStageSpanningTree.TwoStageSpanningTreeSolution — Typestruct TwoStageSpanningTreeSolutionFields
y::BitVectorz::BitMatrix
TwoStageSpanningTree.MILP_separation_problem — MethodMILP_separation_problem(graph, weights; MILP_solver, tol)
Solve the separation problem using the MILP formulation.
TwoStageSpanningTree.anticipative_solution — Functionanticipative_solution(
instance::TwoStageSpanningTreeInstance
) -> NamedTuple{(:value, :y, :z), <:Tuple{Any, Any, Any}}
anticipative_solution(
instance::TwoStageSpanningTreeInstance,
scenario::Int64
) -> NamedTuple{(:value, :y, :z), <:Tuple{Any, Any, Any}}
Compute an anticipative solution for given scenario.
TwoStageSpanningTree.benders_decomposition — Methodbenders_decomposition(
instance::TwoStageSpanningTreeInstance;
MILP_solver,
tol,
verbose
) -> TwoStageSpanningTreeSolution
Returns the optimal solution using a Benders decomposition algorithm.
TwoStageSpanningTree.column_generation — Methodcolumn_generation(
instance;
MILP_solver,
tol,
verbose
) -> NamedTuple{(:value, :ν, :μ, :columns), <:Tuple{Union{Float64, Vector{Float64}}, Vector{Float64}, Any, Vector{BitVector}}}
Solves the linear relaxation using a column generation algorithm.
TwoStageSpanningTree.column_heuristic — Methodcolumn_heuristic(
instance;
MILP_solver,
verbose
) -> TwoStageSpanningTreeSolution
Column generation heuristic, that solves the linear relaxation and then outputs the solution of the proble restricted to selected columns. Returns an heuristic solution.
TwoStageSpanningTree.cut_generation — Methodcut_generation(
instance::TwoStageSpanningTreeInstance;
separation_problem,
MILP_solver,
verbose
) -> TwoStageSpanningTreeSolution
Returns the optimal solution using a cut generation algorithm with custom separation problem solver.
TwoStageSpanningTree.cut_separation_problem — Methodcut_separation_problem(
graph,
weights;
MILP_solver,
tol
) -> Tuple{Any, Any, Any}
Solve the separation problem using the min cut formulation.
TwoStageSpanningTree.is_feasible — Methodis_feasible(
solution::TwoStageSpanningTreeSolution,
instance::TwoStageSpanningTreeInstance;
verbose
) -> Bool
Check if a given solution is feasible for given instance.
TwoStageSpanningTree.kruskal — Methodkruskal(
g::Graphs.AbstractGraph,
weights::AbstractVector;
minimize
) -> NamedTuple{(:value, :tree), <:Tuple{Any, Any}}
Kruskal's algorithm. Same as Graphs.kruskal_mst, but also returns the value of the tree, and a binary vector instead of a vecror of edges.
TwoStageSpanningTree.lagrangian_relaxation — Methodlagrangian_relaxation(
inst::TwoStageSpanningTreeInstance;
nb_epochs,
stop_gap
) -> Tuple{TwoStageSpanningTreeSolution, NamedTuple{(:lb, :ub, :best_theta, :lb_history, :ub_history), <:Tuple{Any, Any, Matrix{Float64}, Vector{Float64}, Vector{Float64}}}}
Return an heuristic solution using a combination of lagarngian relaxation and lagrangian heuristic.
TwoStageSpanningTree.nb_scenarios — Methodnb_scenarios(
instance::TwoStageSpanningTreeInstance
) -> Int64
Return the number of scenarios of instance.
TwoStageSpanningTree.plot_grid_graph — Functionplot_grid_graph(graph, n, m, weights=nothing)Arguments
graph: grid graph to plotn: n dimensionm: m dimensionweights: edge weights to display (optional)
TwoStageSpanningTree.plot_scenario — Methodplot_scenario(
solution::TwoStageSpanningTreeSolution,
instance::TwoStageSpanningTreeInstance,
scenario;
show_node_indices,
δ,
δ₂,
n,
m
)
Plot the two-stage tree from solution for requested scenario.
TwoStageSpanningTree.solution_from_first_stage_forest — Methodsolution_from_first_stage_forest(
forest::BitVector,
instance::TwoStageSpanningTreeInstance
) -> TwoStageSpanningTreeSolution
Return the associated two-stage solution from given first stage forest and instance.
TwoStageSpanningTree.solution_value — Methodsolution_value(
solution::TwoStageSpanningTreeSolution,
instance::TwoStageSpanningTreeInstance
) -> Any
Compute the objective value of given solution for given instance.