Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR: LoadError: ArgumentError: reducing over an empty collection is not allowed #488

Closed
hhkramer opened this issue Mar 30, 2021 · 2 comments · Fixed by #490
Closed

ERROR: LoadError: ArgumentError: reducing over an empty collection is not allowed #488

hhkramer opened this issue Mar 30, 2021 · 2 comments · Fixed by #490
Labels
bug Something isn't working

Comments

@hhkramer
Copy link
Contributor

Describe the bug
When trying to solve my application with coluna using Strong Branching with BestDualBoundStrategy and disabling Primal Heuristics I get the following error:

ERROR: LoadError: ArgumentError: reducing over an empty collection is not allowed

To Reproduce
Parameters are set as follows:

coluna = optimizer_with_attributes(
        Coluna.Optimizer,
        "params" => Coluna.Params(
            solver = Coluna.Algorithm.TreeSearchAlgorithm(
                branchingtreefile = "clsp.dot",
                dividealg = Coluna.Algorithm.StrongBranching(
                    phases = [Coluna.Algorithm.BranchingPhase(20, Coluna.Algorithm.RestrMasterLPConquer()),
                              Coluna.Algorithm.BranchingPhase(2, 
                                                              Coluna.Algorithm.ColCutGenConquer(
                                                                colgen = Coluna.Algorithm.ColumnGeneration(),
                                                                max_nb_cut_rounds = 0,
                                                                primal_heuristics = Coluna.Algorithm.ParameterisedHeuristic[]))],
                    rules = [Coluna.Algorithm.PrioritisedBranchingRule(Coluna.Algorithm.VarBranchingRule(), 1.0, 1.0)]
                ),
                explorestrategy = Coluna.Algorithm.BestDualBoundStrategy(),
                conqueralg = Coluna.Algorithm.ColCutGenConquer(
                    primal_heuristics = Coluna.Algorithm.ParameterisedHeuristic[])
            )
        ),
        "default_optimizer" => Gurobi.Optimizer 
    )

Expected behavior

ERROR: LoadError: ArgumentError: reducing over an empty collection is not allowed
Stacktrace:
 [1] _empty_reduce_error() at .\reduce.jl:299
 [2] reduce_empty(::Function, ::Type{Float64}) at .\reduce.jl:309
 [3] mapreduce_empty(::typeof(identity), ::Function, ::Type{T} where T) at .\reduce.jl:343
 [4] reduce_empty(::Base.MappingRF{typeof(identity),typeof(max)}, ::Type{Float64}) at .\reduce.jl:329
 [5] reduce_empty_iter at .\reduce.jl:355 [inlined]
 [6] mapreduce_empty_iter(::Function, ::Function, ::Array{Float64,1}, ::Base.HasEltype) at .\reduce.jl:351
 [7] _mapreduce(::typeof(identity), ::typeof(max), ::IndexLinear, ::Array{Float64,1}) at .\reduce.jl:400
 [8] _mapreduce_dim at .\reducedim.jl:318 [inlined]
 [9] #mapreduce#620 at .\reducedim.jl:310 [inlined]
 [10] mapreduce at .\reducedim.jl:310 [inlined]
 [11] _maximum at .\reducedim.jl:727 [inlined]
 [12] _maximum at .\reducedim.jl:726 [inlined]
 [13] #maximum#631 at .\reducedim.jl:722 [inlined]
 [14] maximum at .\reducedim.jl:722 [inlined]
 [15] compute_tree_depth_score!(::Coluna.Algorithm.BranchingGroup, ::Coluna.Algorithm.OptimizationState{Coluna.MathProg.Formulation{Coluna.MathProg.DwMaster},
Coluna.MathProg.MinSense}) at C:\Users\hugoh\.julia\packages\Coluna\uQdsR\src\Algorithm\branching\branchinggroup.jl:143
 [16] perform_strong_branching_with_phases!(::Coluna.Algorithm.StrongBranching, ::Coluna.Env, ::Coluna.Algorithm.ReformData, ::Coluna.Algorithm.DivideInput, :
:Array{Coluna.Algorithm.BranchingGroup,1}) at C:\Users\hugoh\.julia\packages\Coluna\uQdsR\src\Algorithm\branching\branchingalgo.jl:174
 [17] run!(::Coluna.Algorithm.StrongBranching, ::Coluna.Env, ::Coluna.Algorithm.ReformData, ::Coluna.Algorithm.DivideInput) at C:\Users\hugoh\.julia\packages\
Coluna\uQdsR\src\Algorithm\branching\branchingalgo.jl:294
 [18] run_divide_algorithm!(::Coluna.Algorithm.TreeSearchAlgorithm, ::Coluna.Env, ::Coluna.Algorithm.TreeSearchRuntimeData{Coluna.MathProg.MinSense}, ::Coluna
.Algorithm.ReformData, ::Coluna.Algorithm.Node) at C:\Users\hugoh\.julia\packages\Coluna\uQdsR\src\Algorithm\treesearch.jl:270
 [19] run!(::Coluna.Algorithm.TreeSearchAlgorithm, ::Coluna.Env, ::Coluna.Algorithm.ReformData, ::Coluna.Algorithm.OptimizationInput{Coluna.MathProg.Formulati
on{Coluna.MathProg.DwMaster},Coluna.MathProg.MinSense}) at C:\Users\hugoh\.julia\packages\Coluna\uQdsR\src\Algorithm\treesearch.jl:340
 [20] optimize!(::Coluna.MathProg.Reformulation, ::Coluna.Env, ::Coluna.ColunaBase.Bound{Coluna.MathProg.Primal,Coluna.MathProg.MinSense}, ::Coluna.ColunaBase
.Bound{Coluna.MathProg.Dual,Coluna.MathProg.MinSense}) at C:\Users\hugoh\.julia\packages\Coluna\uQdsR\src\optimize.jl:98
 [21] macro expansion at C:\Users\hugoh\.julia\packages\Coluna\uQdsR\src\optimize.jl:65 [inlined]
 [22] macro expansion at C:\Users\hugoh\.julia\packages\TimerOutputs\4QAIk\src\TimerOutput.jl:190 [inlined]
 [23] optimize!(::Coluna.MathProg.Problem, ::Coluna.Annotations, ::Coluna.Params) at C:\Users\hugoh\.julia\packages\Coluna\uQdsR\src\optimize.jl:64
 [24] optimize! at C:\Users\hugoh\.julia\packages\Coluna\uQdsR\src\MOIwrapper.jl:101 [inlined]
 [25] optimize!(::MathOptInterface.Bridges.LazyBridgeOptimizer{Coluna.Optimizer}) at C:\Users\hugoh\.julia\packages\MathOptInterface\ZJFKw\src\Bridges\bridge_
optimizer.jl:264
 [26] optimize!(::MathOptInterface.Utilities.CachingOptimizer{MathOptInterface.AbstractOptimizer,MathOptInterface.Utilities.UniversalFallback{MathOptInterface
.Utilities.Model{Float64}}}) at C:\Users\hugoh\.julia\packages\MathOptInterface\ZJFKw\src\Utilities\cachingoptimizer.jl:215
 [27] optimize!(::JuMP.Model, ::Nothing; bridge_constraints::Bool, ignore_optimize_hook::Bool, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple
{(),Tuple{}}}) at C:\Users\hugoh\.julia\packages\JuMP\y5vgk\src\optimizer_interface.jl:139
 [28] optimize!(::JuMP.Model) at C:\Users\hugoh\.julia\packages\BlockDecomposition\OYIcC\src\BlockDecomposition.jl:51
 [29] optimize!(::JuMP.Model, ::Nothing; bridge_constraints::Bool, ignore_optimize_hook::Bool, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple
{(),Tuple{}}}) at C:\Users\hugoh\.julia\packages\JuMP\y5vgk\src\optimizer_interface.jl:129
 [30] optimize! at C:\Users\hugoh\.julia\packages\JuMP\y5vgk\src\optimizer_interface.jl:115 [inlined] (repeats 2 times)
 [31] macro expansion at C:\Users\hugoh\Documents\Codes\Atoptima\UFPB_Project\ColunaBenchmarks\src\CapacitatedLotSizing\run.jl:31 [inlined]
 [32] macro expansion at .\timing.jl:233 [inlined]
 [33] run_clsp(::String, ::Main.CapacitatedLotSizing.AppParams) at C:\Users\hugoh\Documents\Codes\Atoptima\UFPB_Project\ColunaBenchmarks\src\CapacitatedLotSiz
ing\run.jl:30
 [34] top-level scope at C:\Users\hugoh\Documents\Codes\Atoptima\UFPB_Project\ColunaBenchmarks\src\CapacitatedLotSizing\scripts\runsingleinstance.jl:13
 [35] include(::Function, ::Module, ::String) at .\Base.jl:380
 [36] include(::Module, ::String) at .\Base.jl:368
 [37] exec_options(::Base.JLOptions) at .\client.jl:296
 [38] _start() at .\client.jl:506
in expression starting at C:\Users\hugoh\Documents\Codes\Atoptima\UFPB_Project\ColunaBenchmarks\src\CapacitatedLotSizing\scripts\runsingleinstance.jl:13

Environment (please complete the following information):

  • Julia version 1.5.3
  • OS: Windows 10 64 bits
  • Coluna version 0.3.7
@hhkramer hhkramer added the bug Something isn't working label Mar 30, 2021
@guimarqu
Copy link
Contributor

@rrsadykov what should be the value of max_delta if isempty(deltas) ?

max_delta = maximum(deltas)
if nb_zero_deltas < length(deltas) && parent_delta > max_delta * 30
parent_delta = max_delta * 30
end

@rrsadykov
Copy link
Collaborator

rrsadykov commented Mar 31, 2021

If deltas is empty, max_delta and parent_delta can be anything, as they are not used later (score is set to zero if deltas is empty). Sorry for this bug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants