Implement time out when creating the model

This is likely the same problem as Document cost of named variables and constraints in Performance Tips · Issue #2973 · jump-dev/JuMP.jl · GitHub, which led to https://github.com/jump-dev/JuMP.jl/pull/2978.

julia> using JuMP

julia> function main(flag)
           model = Model()
           set_string_names_on_creation(model, flag)
           @variable(model, x[1:386, 1:596, 1:149])
           return model
       end
main (generic function with 1 method)

julia> @time main(false)
  6.122188 seconds (68.56 M allocations: 4.652 GiB, 22.75% gc time)
A JuMP Model
Feasibility problem with:
Variables: 34278344
Model mode: AUTOMATIC
CachingOptimizer state: NO_OPTIMIZER
Solver name: No optimizer attached.
Names registered in the model: x

julia> @time main(true)
ERROR: InterruptException:
# [ ... I didn't want to wait ...] 
1 Like