I’m not sure if a question like this fits more here or on the EAGO GitHub. I’m very new to Julia (started using it three days ago), and I’m also not sure if this is EAGO specific.

In short, I’m trying to learn to use the JuMP optimizer syntax. When I put in a simple test optimization, the minimum of sin(x) or cos(x) for x in [-2, 2], the optimizer works for both (and their negatives), but not for the maximum. For the maximum, I get a KeyError with a *lot* of in between stuff. The program is simple:

```
using JuMP
using EAGO
model = Model(EAGO.Optimizer)
@variable(model, x)
@NLconstraint(model, -2 <= x <= 2)
@NLobjective(model, Max, cos(x))
println("model = ", model)
optimize!(model)
```

I’m using Julia version 1.8.0, JuMP version 0.21.10, and EAGO version 0.6.1. Has anyone else encountered something like this for EAGO or other nonlinear solvers? What’s going on? Should I just negative anything I want the maxima of?

The error text is below. Note that for different functions, a different key number is quoted in the error.

```
ERROR: LoadError: KeyError: key 2 not found
Stacktrace:
[1] getindex
@ ./dict.jl:498 [inlined]
[2] forward_univariate_tiepnt_2!(k::Int64, op::Int64, child_idx::Int64, setstorage::Vector{MC{1, NS}}, x::Vector{Float64}, lbd::Vector{Float64}, ubd::Vector{Float64}, subgrad_tol::Float64, sparsity::Vector{Int64}, tpdict::Dict{Int64, NTuple{4, Int64}}, tp1storage::Vector{Float64}, tp2storage::Vector{Float64}, tp3storage::Vector{Float64}, tp4storage::Vector{Float64}, is_post::Bool, is_intersect::Bool, is_first_eval::Bool, interval_intersect::Bool, ctx::Cassette.Context{nametype(GuardCtx), EAGO.GuardTracker, Nothing, Cassette.var"##PassType#322", Nothing, Nothing})
@ EAGO ~/.julia/packages/EAGO/5sz05/src/eago_optimizer/functions/nonlinear/forward_pass.jl:758
[3] forward_pass_kernel!(nd::Vector{JuMP._Derivatives.NodeData}, adj::SparseArrays.SparseMatrixCSC{Bool, Int64}, x::Vector{Float64}, lbd::Vector{Float64}, ubd::Vector{Float64}, sparsity::Vector{Int64}, setstorage::Vector{MC{1, NS}}, numberstorage::Vector{Float64}, numvalued::Vector{Bool}, tpdict::Dict{Int64, NTuple{4, Int64}}, tp1storage::Vector{Float64}, tp2storage::Vector{Float64}, tp3storage::Vector{Float64}, tp4storage::Vector{Float64}, user_operators::JuMP._Derivatives.UserOperatorRegistry, subexpressions::Vector{EAGO.NonlinearExpression}, func_sparsity::Vector{Int64}, reverse_sparsity::Vector{Int64}, num_mv_buffer::Vector{Float64}, ctx::Cassette.Context{nametype(GuardCtx), EAGO.GuardTracker, Nothing, Cassette.var"##PassType#322", Nothing, Nothing}, is_post::Bool, is_intersect::Bool, is_first_eval::Bool, interval_intersect::Bool, cv_buffer::Vector{Float64}, cc_buffer::Vector{Float64}, treat_x_as_number::Vector{Bool}, subgrad_tol::Float64)
@ EAGO ~/.julia/packages/EAGO/5sz05/src/eago_optimizer/functions/nonlinear/forward_pass.jl:1062
[4] forward_pass!(evaluator::EAGO.Evaluator, d::EAGO.NonlinearExpression{MC{1, NS}})
@ EAGO ~/.julia/packages/EAGO/5sz05/src/eago_optimizer/functions/nonlinear/forward_pass.jl:1098
[5] forward_pass!(evaluator::EAGO.Evaluator, d::EAGO.BufferedNonlinearFunction{MC{1, NS}})
@ EAGO ~/.julia/packages/EAGO/5sz05/src/eago_optimizer/functions/nonlinear/forward_pass.jl:1115
[6] set_constraint_propagation_fbbt!(m::Optimizer)
@ EAGO ~/.julia/packages/EAGO/5sz05/src/eago_optimizer/domain_reduction.jl:677
[7] preprocess!(t::EAGO.DefaultExt, m::Optimizer)
@ EAGO ~/.julia/packages/EAGO/5sz05/src/eago_optimizer/optimize/optimize_nonconvex.jl:595
[8] preprocess!(m::Optimizer)
@ EAGO ~/.julia/packages/EAGO/5sz05/src/eago_optimizer/optimize/optimize_nonconvex.jl:1050
[9] global_solve!(m::Optimizer)
@ EAGO ~/.julia/packages/EAGO/5sz05/src/eago_optimizer/optimize/optimize_nonconvex.jl:1085
[10] optimize!(#unused#::Val{EAGO.MINCVX}, m::Optimizer)
@ EAGO ~/.julia/packages/EAGO/5sz05/src/eago_optimizer/optimize/optimize_nonconvex.jl:1162
[11] optimize!(m::Optimizer)
@ EAGO ~/.julia/packages/EAGO/5sz05/src/eago_optimizer/optimize/optimize.jl:37
[12] optimize!(m::MathOptInterface.Utilities.CachingOptimizer{Optimizer, MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.GenericModel{Float64, MathOptInterface.Utilities.ModelFunctionConstraints{Float64}}}})
@ MathOptInterface.Utilities ~/.julia/packages/MathOptInterface/YDdD3/src/Utilities/cachingoptimizer.jl:252
[13] optimize!(b::MathOptInterface.Bridges.LazyBridgeOptimizer{MathOptInterface.Utilities.CachingOptimizer{Optimizer, MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.GenericModel{Float64, MathOptInterface.Utilities.ModelFunctionConstraints{Float64}}}}})
@ MathOptInterface.Bridges ~/.julia/packages/MathOptInterface/YDdD3/src/Bridges/bridge_optimizer.jl:319
[14] optimize!(m::MathOptInterface.Utilities.CachingOptimizer{MathOptInterface.AbstractOptimizer, MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.GenericModel{Float64, MathOptInterface.Utilities.ModelFunctionConstraints{Float64}}}})
@ MathOptInterface.Utilities ~/.julia/packages/MathOptInterface/YDdD3/src/Utilities/cachingoptimizer.jl:252
[15] optimize!(model::Model, optimizer_factory::Nothing; bridge_constraints::Bool, ignore_optimize_hook::Bool, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ JuMP ~/.julia/packages/JuMP/klrjG/src/optimizer_interface.jl:185
[16] optimize! (repeats 2 times)
@ ~/.julia/packages/JuMP/klrjG/src/optimizer_interface.jl:146 [inlined]
[17] top-level scope
@ ~/Documents/Julia/test.jl:12
```