L-shaped solvers
Documentation for StochasticPrograms.jl's L-shaped solvers.
Index
StochasticPrograms.LShaped.AbstractLShapedAttributeStochasticPrograms.LShaped.AggregateStochasticPrograms.LShaped.AggregationParameterStochasticPrograms.LShaped.AggregatorStochasticPrograms.LShaped.AsynchronousExecutionStochasticPrograms.LShaped.ClusterAggregateStochasticPrograms.LShaped.ClusterAggregationStochasticPrograms.LShaped.ClusterByReferenceStochasticPrograms.LShaped.ConsolidateStochasticPrograms.LShaped.ConsolidationStochasticPrograms.LShaped.ConsolidationParameterStochasticPrograms.LShaped.ConsolidatorStochasticPrograms.LShaped.DontAggregateStochasticPrograms.LShaped.DontConsolidateStochasticPrograms.LShaped.DontRegularizeStochasticPrograms.LShaped.DynamicAggregateStochasticPrograms.LShaped.DynamicAggregationStochasticPrograms.LShaped.FeasibilityCutsStochasticPrograms.LShaped.GranulatedAggregateStochasticPrograms.LShaped.GranulatedAggregationStochasticPrograms.LShaped.HierarchicalStochasticPrograms.LShaped.HybridAggregateStochasticPrograms.LShaped.HybridAggregationStochasticPrograms.LShaped.KmedoidsStochasticPrograms.LShaped.LShapedAlgorithmStochasticPrograms.LShaped.LVStochasticPrograms.LShaped.LevelSetStochasticPrograms.LShaped.NoAggregationStochasticPrograms.LShaped.NoConsolidationStochasticPrograms.LShaped.NoRegularizationStochasticPrograms.LShaped.OptimizerStochasticPrograms.LShaped.PartialAggregateStochasticPrograms.LShaped.PartialAggregationStochasticPrograms.LShaped.RDStochasticPrograms.LShaped.RawConsolidationParameterStochasticPrograms.LShaped.RawRegularizationParameterStochasticPrograms.LShaped.RegularizationParameterStochasticPrograms.LShaped.RegularizedDecompositionStochasticPrograms.LShaped.RegularizerStochasticPrograms.LShaped.SelectClosestStochasticPrograms.LShaped.SelectDecayingStochasticPrograms.LShaped.SelectRandomStochasticPrograms.LShaped.SelectUniformStochasticPrograms.LShaped.SerialExecutionStochasticPrograms.LShaped.SortByReferenceStochasticPrograms.LShaped.StaticClusterStochasticPrograms.LShaped.SynchronousExecutionStochasticPrograms.LShaped.TRStochasticPrograms.LShaped.TrustRegionStochasticPrograms.LShaped.FullAggregationStochasticPrograms.LShaped.absolute_distanceStochasticPrograms.LShaped.angular_distanceStochasticPrograms.LShaped.at_toleranceStochasticPrograms.LShaped.get_aggregation_attributeStochasticPrograms.LShaped.get_consolidation_attributeStochasticPrograms.LShaped.get_regularization_attributeStochasticPrograms.LShaped.set_aggregation_attributeStochasticPrograms.LShaped.set_aggregation_attributeStochasticPrograms.LShaped.set_aggregation_attributesStochasticPrograms.LShaped.set_aggregation_attributesStochasticPrograms.LShaped.set_consolidation_attributeStochasticPrograms.LShaped.set_consolidation_attributeStochasticPrograms.LShaped.set_consolidation_attributesStochasticPrograms.LShaped.set_consolidation_attributesStochasticPrograms.LShaped.set_regularization_attributeStochasticPrograms.LShaped.set_regularization_attributeStochasticPrograms.LShaped.set_regularization_attributesStochasticPrograms.LShaped.set_regularization_attributesStochasticPrograms.LShaped.spatioangular_distance
API
StochasticPrograms.LShaped.LShapedAlgorithm — TypeLShapedAlgorithmFunctor object for the L-shaped algorithm.
...
Algorithm parameters
τ::AbstractFloat = 1e-6: Relative tolerance for convergence checks.debug::Bool = false: Specifies if extra information should be saved for debugging purposes. Defaults to false for memory efficiency.cut_scaling::AbstractFloat = 1.0: Rescaling factor for cutting planes to improve numerical stability.log::Bool = true: Specifices if L-shaped procedure should be logged on standard output or not.
...
StochasticPrograms.LShaped.AbstractLShapedAttribute — TypeAbstractLShapedAttributeAbstract supertype for attribute objects specific to the L-shaped algorithm.
StochasticPrograms.LShaped.AggregationParameter — TypeAggregationParameterAbstract supertype for aggregation-specific attributes.
StochasticPrograms.LShaped.Aggregator — TypeAggregatorAn optimizer attribute for specifying an aggregation procedure to be used in the L-shaped algorithm. Options are:
NoAggregation: Multi-cut L-shaped algorithm (default)PartialAggregation: ?PartialAggregation for parameter descriptions.FullAggregation: ?FullAggregation for parameter descriptions.DynamicAggregation: ?DynamicAggregation for parameter descriptions.ClusterAggregation: ?ClusterAggregation for parameter descriptions.HybridAggregation: ?HybridAggregation for parameter descriptions.
StochasticPrograms.LShaped.ConsolidationParameter — TypeConsolidationParameterAbstract supertype for consolidation-specific attributes.
StochasticPrograms.LShaped.Consolidator — TypeConsolidatorAn optimizer attribute for specifying a consolidation procedure to be used in the L-shaped algorithm. Options are:
StochasticPrograms.LShaped.FeasibilityCuts — TypeFeasibilityCutsAn optimizer attribute for specifying if feasibility cuts should be used in the L-shaped algorithm. Options are true of false.
StochasticPrograms.LShaped.RegularizationParameter — TypeRegularizationParameterAbstract supertype for regularization-specific attributes.
StochasticPrograms.LShaped.Regularizer — TypeRegularizerAn optimizer attribute for specifying a regularization procedure to be used in the L-shaped algorithm. Options are:
NoRegularization: L-shaped algorithm (default)RegularizedDecomposition: Regularized decomposition ?RegularizedDecomposition for parameter descriptions.TrustRegion: Trust-region ?TrustRegion for parameter descriptions.LevelSet: Level-set ?LevelSet for parameter descriptions.
StochasticPrograms.LShaped.Optimizer — TypeOptimizer(; <keyword arguments>)Return an L-shaped optimizer. ...
Arguments
master_optimizer::AbstractOptimizer: MathOptInterface solver capable of solving linear (and possibly quadratic) programs.subproblem_optimizer::AbstractOptimizer: Optionally specify a different solver for the subproblems.feasibility_cuts::Bool = false: Specify if feasibility cuts should be usedregularize::AbstractRegularizer = DontRegularize(): Specify regularization procedure (DontRegularize, RegularizedDecomposition/RD/WithRegularizedDecomposition, TrustRegion/TR/WithTrustRegion, LevelSet/LV/WithLevelSets).aggregate::AbstractAggregator = DontAggregate(): Specify aggregation procedure (DontAggregate, Aggregate, PartialAggregate, DynamicAggregate, ClusterAggregate, GranulatedAggregate, HybridAggregate)consolidate::AbstractConsolidator = DontConsolidate(): Specify consolidation procedure (DontConsolidate, Consolidate)execution::Execution = Serial: Specify how algorithm should be executed (Serial, Synchronous, Asynchronous). Distributed variants requires worker cores.- <keyword arguments>: Algorithm specific parameters, See
?LShapedfor list of possible arguments and default values.
...
StochasticPrograms.LShaped.get_aggregation_attribute — Methodget_aggregation_attribute(stochasticprogram::StochasticProgram, name::String)Return the value associated with the aggregation-specific attribute named name in stochasticprogram.
See also: set_aggregation_attribute, set_aggregation_attributes.
StochasticPrograms.LShaped.get_consolidation_attribute — Methodget_consolidation_attribute(stochasticprogram::StochasticProgram, name::String)Return the value associated with the consolidation-specific attribute named name in stochasticprogram.
See also: set_consolidation_attribute, set_consolidation_attributes.
StochasticPrograms.LShaped.get_regularization_attribute — Methodget_regularization_attribute(stochasticprogram::StochasticProgram, name::String)Return the value associated with the regularization-specific attribute named name in stochasticprogram.
See also: set_regularization_attribute, set_regularization_attributes.
StochasticPrograms.LShaped.set_aggregation_attribute — Methodset_aggregation_attribute(stochasticprogram::StochasticProgram, name::Union{Symbol, String}, value)Sets the aggregation-specific attribute identified by name to value.
StochasticPrograms.LShaped.set_aggregation_attributes — Methodset_aggregation_attributes(stochasticprogram::StochasticProgram, pairs::Pair...)Given a list of attribute => value pairs or a collection of keyword arguments, calls set_aggregation_attribute(stochasticprogram, attribute, value) for each pair.
StochasticPrograms.LShaped.set_consolidation_attribute — Methodset_consolidation_attribute(stochasticprogram::StochasticProgram, name::Union{Symbol, String}, value)Sets the consolidation-specific attribute identified by name to value.
StochasticPrograms.LShaped.set_consolidation_attributes — Methodset_consolidation_attributes(stochasticprogram::StochasticProgram, pairs::Pair...)Given a list of attribute => value pairs or a collection of keyword arguments, calls set_consolidation_attribute(stochasticprogram, attribute, value) for each pair.
StochasticPrograms.LShaped.set_regularization_attribute — Methodset_regularization_attribute(stochasticprogram::StochasticProgram, name::Union{Symbol, String}, value)Sets the regularization-specific attribute identified by name to value.
StochasticPrograms.LShaped.set_regularization_attributes — Methodset_regularization_attributes(stochasticprogram::StochasticProgram, pairs::Pair...)Given a list of attribute => value pairs or a collection of keyword arguments, calls set_regularization_attribute(stochasticprogram, attribute, value) for each pair.
Execution
StochasticPrograms.LShaped.SerialExecution — TypeSerialExecutionFunctor object for using serial execution in a lshaped algorithm. Create by supplying a Serial object through execution in the LShapedSolver factory function and then pass to a StochasticPrograms.jl model.
StochasticPrograms.LShaped.SynchronousExecution — TypeSynchronousExecutionFunctor object for using synchronous execution in an L-shaped algorithm (assuming multiple Julia cores are available). Create by supplying a Synchronous object through execution in the LShapedSolver factory function and then pass to a StochasticPrograms.jl model.
StochasticPrograms.LShaped.AsynchronousExecution — TypeAsynchronousExecutionFunctor object for using synchronous execution in an L-shaped algorithm (assuming multiple Julia cores are available). Create by supplying a Asynchronous object through execution in the LShapedSolver factory function and then pass to a StochasticPrograms.jl model.
Regularization
StochasticPrograms.LShaped.set_regularization_attribute — Functionset_regularization_attribute(stochasticprogram::StochasticProgram, name::Union{Symbol, String}, value)Sets the regularization-specific attribute identified by name to value.
StochasticPrograms.LShaped.set_regularization_attributes — Functionset_regularization_attributes(stochasticprogram::StochasticProgram, pairs::Pair...)Given a list of attribute => value pairs or a collection of keyword arguments, calls set_regularization_attribute(stochasticprogram, attribute, value) for each pair.
StochasticPrograms.LShaped.RawRegularizationParameter — TypeRawRegularizationParameterAn optimizer attribute used for raw parameters of the regularizer. Defers to RawParameter.
StochasticPrograms.LShaped.NoRegularization — TypeNoRegularizationEmpty functor object for running an L-shaped algorithm without regularization.
StochasticPrograms.LShaped.DontRegularize — TypeDontRegularizeFactory object for NoRegularization. Passed by default to regularize in the LShapedSolver factory function.
StochasticPrograms.LShaped.RegularizedDecomposition — TypeRegularizedDecompositionFunctor object for using regularized decomposition regularization in an L-shaped algorithm. Create by supplying an RD object through regularize in the LShapedSolver factory function and then pass to a StochasticPrograms.jl model.
...
Parameters
σ::AbstractFloat = 1.0: Initial value of regularization parameter. Controls the relative penalty of the deviation from the current major iterate.σ̅::AbstractFloat = 4.0: Maximum value of the regularization parameter.σ̲::AbstractFloat = 0.5: Minimum value of the regularization parameter.log::Bool = true: Specifices if L-shaped procedure should be logged on standard output or not.penaltyterm::PenaltyTerm = Quadratic: Specify penaltyterm variant (Quadratic,Linearized,InfNorm, [ManhattanNorm][@ref])
...
StochasticPrograms.LShaped.RD — TypeRDFactory object for RegularizedDecomposition. Pass to regularize in the LShapedSolver factory function. Equivalent factory calls: RD, WithRD, RegularizedDecomposition, WithRegularizedDecomposition. See ?RegularizedDecomposition for parameter descriptions.
StochasticPrograms.LShaped.TrustRegion — TypeTrustRegionFunctor object for using trust-region regularization in an L-shaped algorithm. Create by supplying a TR object through regularize in the LShapedSolver factory function and then pass to a StochasticPrograms.jl model.
...
Parameters
γ::T = 1e-4: Relative tolerance for deciding if a minor iterate should be accepted as a new major iterate.Δ::AbstractFloat = 1.0: Initial size of ∞-norm trust-region.Δ̅::AbstractFloat = 1000.0: Maximum size of ∞-norm trust-region.
...
StochasticPrograms.LShaped.TR — TypeTRFactory object for TrustRegion. Pass to regularize in the LShapedSolver factory function. Equivalent factory calls: TR, WithTR, TrustRegion, WithTrustRegion. See ?TrustRegion for parameter descriptions.
StochasticPrograms.LShaped.LevelSet — TypeLevelSetFunctor object for using level-set regularization in an L-shaped algorithm. Create by supplying an LV object through regularize in the LShapedSolver factory function and then pass to a StochasticPrograms.jl model.
...
Parameters
λ::AbstractFloat = 0.5: Controls the level position L = (1-λ)θ + λQ̃, a convex combination of the current lower and upper bound.penaltyterm::PenaltyTerm = Quadratic: Specify penaltyterm variant (Quadratic,Linearized,InfNorm, [ManhattanNorm][@ref])
...
StochasticPrograms.LShaped.LV — TypeLVFactory object for LevelSet. Pass to regularize in the LShapedSolver factory function. Equivalent factory calls: LV, WithLV, LevelSet, WithLevelSets. See ?LevelSet for parameter descriptions.
Aggregation
StochasticPrograms.LShaped.set_aggregation_attribute — Functionset_aggregation_attribute(stochasticprogram::StochasticProgram, name::Union{Symbol, String}, value)Sets the aggregation-specific attribute identified by name to value.
StochasticPrograms.LShaped.set_aggregation_attributes — Functionset_aggregation_attributes(stochasticprogram::StochasticProgram, pairs::Pair...)Given a list of attribute => value pairs or a collection of keyword arguments, calls set_aggregation_attribute(stochasticprogram, attribute, value) for each pair.
StochasticPrograms.LShaped.DontAggregate — TypeDontAggregateFactory object for NoAggregation. Passed by default to aggregate in LShaped.Optimizer.
StochasticPrograms.LShaped.NoAggregation — TypeNoAggregationEmpty functor object for running an L-shaped algorithm without aggregation (multi-cut L-shaped).
StochasticPrograms.LShaped.Aggregate — TypeAggregateFactory object for FullAggregation. Pass to aggregate in LShaped.Optimizer or by setting the Aggregator attribute.
StochasticPrograms.LShaped.PartialAggregate — TypePartialAggregateFactory object for PartialAggregation. Pass to aggregate in LShaped.Optimizer or by setting the Aggregator attribute. See ?PartialAggregation for parameter descriptions.
StochasticPrograms.LShaped.PartialAggregation — TypePartialAggregationFunctor object for using partial aggregation in an L-shaped algorithm. Create by supplying a PartialAggregate object through aggregate in LShaped.Optimizer or by setting the Aggregator attribute.
...
Parameters
size::Int: Number of cuts in each aggregate
...
StochasticPrograms.LShaped.FullAggregation — MethodFullAggregationFunctor object for using complete aggregation in an L-shaped algorithm. Create by supplying an Aggregate object through aggregate in the LShapedSolver factory function and then pass to a StochasticPrograms.jl model.
StochasticPrograms.LShaped.DynamicAggregate — TypeDynamicAggregate(num_aggregates::Integer, rule::AbstractSelectionRule; lock_after::Function = (τ,n)->false)Factory object for DynamicAggregation. Pass to aggregate in LShaped.Optimizer or by setting the Aggregator attribute. See ?DynamicAggregation for parameter descriptions.
StochasticPrograms.LShaped.DynamicAggregation — TypeDynamicAggregationFunctor object for using dynamic aggregation in an L-shaped algorithm. Create by supplying a DynamicAggregate object through aggregate in LShaped.Optimizer or by setting the Aggregator attribute.
The following selection rules are available
SelectUniformSelectDecaying- [
SelectRandom](@ref SelectClosestSortByReference
...
Parameters
num_aggregates::Int: Number of aggregatesrule::SelectionRule: Rule that determines which aggregate an incoming cut should be placed inlock_after::Function = (τ,n)->false: Function that determines if the current aggregation scheme should be fixed, based on the current optimality gapτand the number of iterationsn
...
StochasticPrograms.LShaped.ClusterAggregate — TypeClusterAggregate(rule::AbstractClusterRule; lock_after::Function = (τ,n)->false)Factory object for ClusterAggregation. Pass to aggregate in LShaped.Optimizer or by setting the Aggregator attribute. See ?ClusterAggregation for parameter descriptions.
StochasticPrograms.LShaped.ClusterAggregation — TypeClusterAggregationFunctor object for using cluster aggregation in an L-shaped algorithm. Create by supplying a ClusterAggregate object through aggregate in LShaped.Optimizer or by setting the Aggregator attribute.
The following cluster rules are available
StaticClusterClusterByReference- [
Kmedoids](@ref Hierarchical
...
Parameters
rule::ClusterRule: Rule that determines how cuts should be sorted into clusterslock_after::Function = (τ,n)->false: Function that determines if the current aggregation scheme should be fixed, based on the current optimality gapτand the number of iterationsn
...
StochasticPrograms.LShaped.GranulatedAggregate — TypeGranulatedAggregateFactory object for GranulatedAggregation. Pass to aggregate in LShaped.Optimizer or by setting the Aggregator attribute. See ?GranulatedAggregation for parameter descriptions.
StochasticPrograms.LShaped.GranulatedAggregation — TypeGranulatedAggregationFunctor object for using partial aggregation in an L-shaped algorithm. Create by supplying a GranulatedAggregate object through aggregate in LShaped.Optimizer or by setting the Aggregator attribute.
...
Parameters
size::Int: Number of cuts in each aggregate
...
StochasticPrograms.LShaped.HybridAggregate — TypeHybridAggregate(initial::AbstractAggregator, final::AbstractAggregator, τ::AbstractFloat)Factory object for HybridAggregation. Pass to aggregate in LShaped.Optimizer or by setting the Aggregator attribute. See ?HybridAggregation for parameter descriptions.
StochasticPrograms.LShaped.HybridAggregation — TypeHybridAggregationFunctor object for using hybrid aggregation in an L-shaped algorithm. Create by supplying a HybridAggregate object through aggregate in LShaped.Optimizer or by setting the Aggregator attribute.
...
Parameters
initial::AbstractAggregator: Initial aggregation schemefinal::AbstractAggregator: Final aggregation schemeτ::T: The active aggregation scheme is switched frominitialtofinalwhen the optimality gap decreases belowτ
...
Selection rules
StochasticPrograms.LShaped.SelectClosest — TypeSelectClosest(τ::AbstractFloat; distance::Function = absolute_distance)Incoming cuts are placed into the closest aggregate, according the supplied distance function. An empty aggregate is chosen if no aggregate is within the tolerance τ
The following distance measures are available
absolute_distanceangular_distance- [
spatioangular_distance](@ref
StochasticPrograms.LShaped.SelectDecaying — TypeSelectDecaying(T₀::Integer, T̲::Integer = 1, γ::T)Behaves like SelectUniform, but the uniform aggregate size decays by γ each iteration, starting from T₀. T̲ is an optional lower bound on the aggregate size.
StochasticPrograms.LShaped.SelectRandom — TypeSelectRandom(max = Inf)Incoming cuts are placed into aggregates randomly. An optional maximum number of cuts max can be specified.
StochasticPrograms.LShaped.SelectUniform — TypeSelectUniform(n::Integer)Incoming cuts are placed into aggregates uniformly, so that each aggregate has at most n cuts. Behaves as PartialAggregation.
StochasticPrograms.LShaped.SortByReference — TypeSortByReference(τ::AbstractFloat; distance::Function = absolute_distance)Incoming cuts are placed into an aggregate based on the distance to a reference cut, according the supplied distance function. Behaves as SelectClosest if not withing the tolerance τ to the reference cut.
The following distance measures are available
absolute_distanceangular_distance- [
spatioangular_distance](@ref
Cluster rules
StochasticPrograms.LShaped.ClusterByReference — MethodClusterByReference(τ::AbstractFloat; distance::Function = absolute_distance)Buffered cuts are aggregated if within the tolerance τ to a reference cut, according the supplied distance function. Behaves as multi-cut otherwise.
The following distance measures are available
absolute_distanceangular_distance- [
spatioangular_distance](@ref
StochasticPrograms.LShaped.Hierarchical — TypeHierarchical(nclusters::Int; distance::Function = absolute_distance, linkage::Symbol = :single)Buffered cuts are sorted into nclusters clusters, using a Hierarchical algorithm, with the given linkage, over a generalized distance matrix.
The following distance measures are available
absolute_distanceangular_distance- [
spatioangular_distance](@ref
StochasticPrograms.LShaped.Kmedoids — TypeKmedoids(nclusters::Int; distance::Function = absolute_distance)Buffered cuts are sorted into nclusters clusters, using a K-medoids algorithm over a generalized distance matrix.
The following distance measures are available
absolute_distanceangular_distance- [
spatioangular_distance](@ref
StochasticPrograms.LShaped.StaticCluster — TypeStaticCluster(clusters::Vector{Float64})Buffered cuts are sorting according to the supplied weights clusters
Distance measures
StochasticPrograms.LShaped.absolute_distance — Methodabsolute_distance(c₁::AnyOptimalityCut, c₂::AnyOptimalityCut)Absolute distance between two optimality cuts
StochasticPrograms.LShaped.angular_distance — Methodangular_distance(c₁::AnyOptimalityCut, c₂::AnyOptimalityCut)Angular distance between two optimality cuts
StochasticPrograms.LShaped.spatioangular_distance — Methodspatioangular_distance(c₁::AnyOptimalityCut, c₂::AnyOptimalityCut)Spatioangular distance between two optimality cuts.
Consolidation
StochasticPrograms.LShaped.set_consolidation_attribute — Functionset_consolidation_attribute(stochasticprogram::StochasticProgram, name::Union{Symbol, String}, value)Sets the consolidation-specific attribute identified by name to value.
StochasticPrograms.LShaped.set_consolidation_attributes — Functionset_consolidation_attributes(stochasticprogram::StochasticProgram, pairs::Pair...)Given a list of attribute => value pairs or a collection of keyword arguments, calls set_consolidation_attribute(stochasticprogram, attribute, value) for each pair.
StochasticPrograms.LShaped.Consolidate — TypeConsolidateFactory object for Consolidation. Pass to consolidate in the LShapedSolver factory function. See ?Consolidation for parameter descriptions.
StochasticPrograms.LShaped.Consolidation — TypeConsolidationFunctor object for using consolidation in an L-shaped algorithm. Create by supplying a Consolidate object through consolidate in the LShapedSolver factory function and then pass to a StochasticPrograms.jl model.
...
Algorithm parameters
tresh::T= 0.95: Relative amount of redundant cuts in a former iteration required to consider the iteration redundantat::Int = 5.0: Number of times an iteration can be redundant before consolidation is triggeredrebuild::Function = at_tolerance(): Function deciding when the master model should be rebuilt according to performed consolidations
...
StochasticPrograms.LShaped.DontConsolidate — TypeDontConsolidateFactory object for NoConsolidation. Passed by default to consolidate in the LShapedSolver factory function.
StochasticPrograms.LShaped.NoConsolidation — TypeNoRegularizationEmpty functor object for running the L-shaped algorithm without consolidation.
StochasticPrograms.LShaped.RawConsolidationParameter — TypeRawConsolidationParameterAn optimizer attribute used for raw parameters of the consolidator. Defers to RawParameter.
StochasticPrograms.LShaped.at_tolerance — Methodat_tolerance(τ = 0.4, miniter = 0)Rebuild master when at least nconsolidations*miniter iterations has passed and the ratio of number of cuts in the consolidated collection and the number of cuts in the master model has decreased below τ.