API

TwoStageSpanningTree.TwoStageSpanningTreeInstanceType
struct TwoStageSpanningTreeInstance{T}

Fields

  • graph::Graphs.SimpleGraphs.SimpleGraph{Int64}: Graph

  • first_stage_costs::Vector: First stage costs for each edge

  • second_stage_costs::Matrix: Second stage costs for each edge and scenario [e, s]

source
TwoStageSpanningTree.anticipative_solutionFunction
anticipative_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.

source
TwoStageSpanningTree.benders_decompositionMethod
benders_decomposition(
    instance::TwoStageSpanningTreeInstance;
    MILP_solver,
    tol,
    verbose
) -> TwoStageSpanningTreeSolution

Returns the optimal solution using a Benders decomposition algorithm.

source
TwoStageSpanningTree.column_generationMethod
column_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.

source
TwoStageSpanningTree.column_heuristicMethod
column_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.

source
TwoStageSpanningTree.cut_generationMethod
cut_generation(
    instance::TwoStageSpanningTreeInstance;
    separation_problem,
    MILP_solver,
    verbose
) -> TwoStageSpanningTreeSolution

Returns the optimal solution using a cut generation algorithm with custom separation problem solver.

source
TwoStageSpanningTree.is_feasibleMethod
is_feasible(
    solution::TwoStageSpanningTreeSolution,
    instance::TwoStageSpanningTreeInstance;
    verbose
) -> Bool

Check if a given solution is feasible for given instance.

source
TwoStageSpanningTree.kruskalMethod
kruskal(
    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.

source
TwoStageSpanningTree.lagrangian_relaxationMethod
lagrangian_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.

source
TwoStageSpanningTree.plot_scenarioMethod
plot_scenario(
    solution::TwoStageSpanningTreeSolution,
    instance::TwoStageSpanningTreeInstance,
    scenario;
    show_node_indices,
    δ,
    δ₂,
    n,
    m
)

Plot the two-stage tree from solution for requested scenario.

source
TwoStageSpanningTree.solution_valueMethod
solution_value(
    solution::TwoStageSpanningTreeSolution,
    instance::TwoStageSpanningTreeInstance
) -> Any

Compute the objective value of given solution for given instance.

source