Skip to content

MethodError: reducing over an empty collection #142

Open
@odow

Description

julia> using JuMP, EAGO

julia> begin
           model = Model(EAGO.Optimizer)
           @variable(model, x == 2)
           @variable(model, y == 3)
           @constraint(model, sqrt(x * y) <= 3)
           optimize!(model)
       end
ERROR: MethodError: reducing over an empty collection is not allowed; consider supplying `init` to the reducer
Stacktrace:
  [1] reduce_empty(op::Base.MappingRF{EAGO.var"#1#2"{EAGO.var"#134#135"{EAGO.GlobalOptimizer{}}}, Base.BottomRF{typeof(EAGO._rf_findmax)}}, ::Type{Pair{Int64, Int64}})
    @ Base ./reduce.jl:361
  [2] reduce_empty_iter
    @ ./reduce.jl:384 [inlined]
  [3] reduce_empty_iter
    @ ./reduce.jl:383 [inlined]
  [4] foldl_impl
    @ ./reduce.jl:49 [inlined]
  [5] mapfoldl_impl
    @ ./reduce.jl:44 [inlined]
  [6] mapfoldl
    @ ./reduce.jl:175 [inlined]
  [7] map_findmax
    @ ~/.julia/packages/EAGO/oWEmA/src/eago_optimizer/utilities.jl:35 [inlined]
  [8] map_argmax
    @ ~/.julia/packages/EAGO/oWEmA/src/eago_optimizer/utilities.jl:36 [inlined]
  [9] _select_branch_variable_width
    @ ~/.julia/packages/EAGO/oWEmA/src/eago_optimizer/optimize/nonconvex/stack_management.jl:95 [inlined]
 [10] select_branch_variable
    @ ~/.julia/packages/EAGO/oWEmA/src/eago_optimizer/optimize/nonconvex/stack_management.jl:106 [inlined]
 [11] branch_node!(t::EAGO.DefaultExt, m::EAGO.GlobalOptimizer{EAGO.Incremental{Cbc.Optimizer}, EAGO.Incremental{Ipopt.Optimizer}, EAGO.DefaultExt})
    @ EAGO ~/.julia/packages/EAGO/oWEmA/src/eago_optimizer/optimize/nonconvex/stack_management.jl:137
 [12] branch_node!
    @ ~/.julia/packages/EAGO/oWEmA/src/eago_optimizer/optimize/nonconvex/stack_management.jl:179 [inlined]
 [13] global_solve!(m::EAGO.GlobalOptimizer{EAGO.Incremental{Cbc.Optimizer}, EAGO.Incremental{Ipopt.Optimizer}, EAGO.DefaultExt})
    @ EAGO ~/.julia/packages/EAGO/oWEmA/src/eago_optimizer/optimize/optimize_nonconvex.jl:425
 [14] optimize!
    @ ~/.julia/packages/EAGO/oWEmA/src/eago_optimizer/optimize/optimize_nonconvex.jl:493 [inlined]
 [15] optimize!(m::Optimizer{EAGO.Incremental{Cbc.Optimizer}, EAGO.Incremental{Ipopt.Optimizer}, EAGO.DefaultExt})
    @ EAGO ~/.julia/packages/EAGO/oWEmA/src/eago_optimizer/optimize/optimize.jl:40
 [16] optimize!
    @ ~/.julia/packages/MathOptInterface/gLl4d/src/Bridges/bridge_optimizer.jl:367 [inlined]
 [17] optimize!
    @ ~/.julia/packages/MathOptInterface/gLl4d/src/MathOptInterface.jl:122 [inlined]
 [18] optimize!(m::MathOptInterface.Utilities.CachingOptimizer{MathOptInterface.Bridges.LazyBridgeOptimizer{…}, MathOptInterface.Utilities.UniversalFallback{…}})
    @ MathOptInterface.Utilities ~/.julia/packages/MathOptInterface/gLl4d/src/Utilities/cachingoptimizer.jl:321
 [19] optimize!(model::Model; ignore_optimize_hook::Bool, _differentiation_backend::MathOptInterface.Nonlinear.SparseReverseMode, kwargs::@Kwargs{})
    @ JuMP ~/.julia/packages/JuMP/i68GU/src/optimizer_interface.jl:595
 [20] optimize!(model::Model)
    @ JuMP ~/.julia/packages/JuMP/i68GU/src/optimizer_interface.jl:546
 [21] top-level scope
    @ REPL[16]:6
Some type information was truncated. Use `show(err)` to see complete types.

(ipopt) pkg> st
Status `/private/tmp/ipopt/Project.toml`
  [bb8be931] EAGO v0.8.2
  [4076af6c] JuMP v1.23.5

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions