-
Notifications
You must be signed in to change notification settings - Fork 8
Description
Implementing the following simple model fails on CPU, despite an observable optimal solution existing. The issue arises from the inclusion of objective o being across the empty set 1:0. The identical model with backend=CUDABackend() has no issues.
`julia> c = ExaModels.ExaCore(Float64; backend = nothing)
An ExaCore
Float type: ...................... Float64
Array type: ...................... Vector{Float64}
Backend: ......................... Nothing
number of objective patterns: .... 0
number of constraint patterns: ... 0
julia> a = variable(c, 0)
Variable
x ∈ R^{0}
julia> b = variable(c, 3)
Variable
x ∈ R^{3}
julia> o = objective(c, a[i] for i in 1:0)
Objective
min (...) + ∑_{p ∈ P} f(x,p)
where |P| = 0
julia> o2 = objective(c, b[i]^2 for i in 1:3)
Objective
min (...) + ∑_{p ∈ P} f(x,p)
where |P| = 3
julia> m = ExaModels.ExaModel(c;)
An ExaModel{Float64, Vector{Float64}, ...}
Problem name: Generic
All variables: ████████████████████ 3 All constraints: ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅ 0
free: ████████████████████ 3 free: ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅ 0
lower: ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅ 0 lower: ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅ 0
upper: ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅ 0 upper: ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅ 0
low/upp: ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅ 0 low/upp: ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅ 0
fixed: ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅ 0 fixed: ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅ 0
infeas: ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅ 0 infeas: ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅ 0
nnzh: ( 50.00% sparsity) 3 linear: ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅ 0
nonlinear: ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅ 0
nnzj: (------% sparsity)
julia> result = madnlp(m)
This is MadNLP version v0.8.5, running with umfpack
Number of nonzeros in constraint Jacobian............: 0
Number of nonzeros in Lagrangian Hessian.............: 3
Total number of variables............................: 3
variables with only lower bounds: 0
variables with lower and upper bounds: 0
variables with only upper bounds: 0
Total number of equality constraints.................: 0
Total number of inequality constraints...............: 0
inequality constraints with only lower bounds: 0
inequality constraints with lower and upper bounds: 0
inequality constraints with only upper bounds: 0
EXIT: Internal Error.
ERROR: ArgumentError: reducing over an empty collection is not allowed; consider supplying init to the reducer
Stacktrace:
[1] _empty_reduce_error()
@ Base ./reduce.jl:319
[2] mapreduce_empty(f::Function, op::Base.BottomRF{typeof(Base.add_sum)}, T::Type)
@ Base ./reduce.jl:321
[3] reduce_empty(op::Base.MappingRF{ExaModels.var"#283#284"{ExaModels.Objective{ExaModels.ObjectiveNull, ExaModels.SIMDFunction{ExaModels.Var{ExaModels.ParSource}, ExaModels.Compressor{Tuple{…}}, ExaModels.Compressor{Tuple{}}}, UnitRange{Int64}}, Vector{Float64}}, Base.BottomRF{typeof(Base.add_sum)}}, ::Type{Int64})
@ Base ./reduce.jl:358
[4] reduce_empty_iter
@ ./reduce.jl:381 [inlined]
[5] reduce_empty_iter
@ ./reduce.jl:380 [inlined]
[6] foldl_impl
@ ./reduce.jl:49 [inlined]
[7] mapfoldl_impl
@ ./reduce.jl:44 [inlined]
[8] mapfoldl
@ ./reduce.jl:175 [inlined]
[9] mapreduce
@ ./reduce.jl:307 [inlined]
[10] sum
@ ./reduce.jl:532 [inlined]
[11] sum
@ ./reduce.jl:561 [inlined]
[12] sum
@ ~/.julia/packages/ExaModels/CGCQ6/src/templates.jl:5 [inlined]
[13] _obj
@ ~/.julia/packages/ExaModels/CGCQ6/src/nlp.jl:608 [inlined]
[14] _obj(objs::ExaModels.Objective{ExaModels.Objective{ExaModels.ObjectiveNull, ExaModels.SIMDFunction{…}, UnitRange{…}}, ExaModels.SIMDFunction{ExaModels.Node1{…}, ExaModels.Compressor{…}, ExaModels.Compressor{…}}, UnitRange{Int64}}, x::Vector{Float64})
@ ExaModels ~/.julia/packages/ExaModels/CGCQ6/src/nlp.jl:608
[15] obj
@ ~/.julia/packages/ExaModels/CGCQ6/src/nlp.jl:605 [inlined]
[16] _eval_f_wrapper
@ ~/.julia/packages/MadNLP/6x6Eg/src/nlpmodels.jl:652 [inlined]
[17] macro expansion
@ ~/.julia/packages/MadNLP/6x6Eg/src/IPM/callbacks.jl:7 [inlined]
[18] macro expansion
@ ./timing.jl:421 [inlined]
[19] eval_f_wrapper(solver::MadNLPSolver{Float64, Vector{…}, Vector{…}, MadNLP.SparseKKTSystem{…}, ExaModel{…}, MadNLP.SparseCallback{…}, MadNLP.RichardsonIterator{…}, MadNLP.InertiaFree{…}, MadNLP.UnreducedKKTVector{…}}, x::MadNLP.PrimalVector{Float64, Vector{…}, Vector{…}})
@ MadNLP ~/.julia/packages/MadNLP/6x6Eg/src/IPM/callbacks.jl:5
[20] initialize!(solver::MadNLPSolver{Float64, Vector{…}, Vector{…}, MadNLP.SparseKKTSystem{…}, ExaModel{…}, MadNLP.SparseCallback{…}, MadNLP.RichardsonIterator{…}, MadNLP.InertiaFree{…}, MadNLP.UnreducedKKTVector{…}})
@ MadNLP ~/.julia/packages/MadNLP/6x6Eg/src/IPM/solver.jl:73
[21] solve!(nlp::ExaModel{…}, solver::MadNLPSolver{…}, stats::MadNLP.MadNLPExecutionStats{…}; x::Nothing, y::Nothing, zl::Nothing, zu::Nothing, kwargs::@kwargs{})
@ MadNLP ~/.julia/packages/MadNLP/6x6Eg/src/IPM/solver.jl:159
[22] solve!
@ ~/.julia/packages/MadNLP/6x6Eg/src/IPM/solver.jl:128 [inlined]
[23] solve!
@ ~/.julia/packages/MadNLP/6x6Eg/src/IPM/solver.jl:14 [inlined]
[24] solve!(solver::MadNLPSolver{Float64, Vector{…}, Vector{…}, MadNLP.SparseKKTSystem{…}, ExaModel{…}, MadNLP.SparseCallback{…}, MadNLP.RichardsonIterator{…}, MadNLP.InertiaFree{…}, MadNLP.UnreducedKKTVector{…}})
@ MadNLP ~/.julia/packages/MadNLP/6x6Eg/src/IPM/solver.jl:17
[25] madnlp(model::ExaModel{Float64, Vector{Float64}, Nothing, ExaModels.Objective{ExaModels.Objective{…}, ExaModels.SIMDFunction{…}, UnitRange{…}}, ExaModels.ConstraintNull}; kwargs::@kwargs{})
@ MadNLP ~/.julia/packages/MadNLP/6x6Eg/src/IPM/solver.jl:11
[26] madnlp(model::ExaModel{Float64, Vector{Float64}, Nothing, ExaModels.Objective{ExaModels.Objective{ExaModels.ObjectiveNull, ExaModels.SIMDFunction{…}, UnitRange{…}}, ExaModels.SIMDFunction{ExaModels.Node1{…}, ExaModels.Compressor{…}, ExaModels.Compressor{…}}, UnitRange{Int64}}, ExaModels.ConstraintNull})
@ MadNLP ~/.julia/packages/MadNLP/6x6Eg/src/IPM/solver.jl:9
[27] top-level scope
@ REPL[39]:1
Some type information was truncated. Use show(err) to see complete types.`