JuMP reports an error when attempting to sum the empty DenseAxisArray as the objective function

you can use the generator syntax:

using JuMP

set = Symbol[]
m = Model()

@variable(m, x[i in set])
@objective(m, Min, sum(x[i] for i in set; init=0.0))
1 Like