Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BoundsError in NLP classify_linearity #2340

Closed
odow opened this issue Sep 21, 2020 · 0 comments · Fixed by #2341
Closed

BoundsError in NLP classify_linearity #2340

odow opened this issue Sep 21, 2020 · 0 comments · Fixed by #2341
Assignees

Comments

@odow
Copy link
Member

odow commented Sep 21, 2020

(jump) pkg> st
Status `/private/tmp/jump/Project.toml`
  [b6b21f68] Ipopt v0.6.3
  [4076af6c] JuMP v0.21.5

julia> using JuMP, Ipopt

julia> model = Model(Ipopt.Optimizer)
A JuMP Model
Feasibility problem with:
Variables: 0
Model mode: AUTOMATIC
CachingOptimizer state: EMPTY_OPTIMIZER
Solver name: Ipopt

julia> @variable(model, x)
x

julia> foo(x, y) = x + y
foo (generic function with 1 method)

julia> register(model, :foo, 2, foo, autodiff=true)

julia> ex = @NLexpression(model, foo(x^2, x))
"Reference to nonlinear expression #1"

julia> @NLobjective(model, Max, ex)

julia> optimize!(model)
ERROR: BoundsError: attempt to access 8-element Array{Symbol,1} at index [9]
Stacktrace:
 [1] getindex at ./array.jl:809 [inlined]
 [2] classify_linearity(::Array{JuMP._Derivatives.NodeData,1}, ::SparseArrays.SparseMatrixCSC{Bool,Int64}, ::Array{JuMP._Derivatives.Linearity,1}) at /Users/oscar/.julia/packages/JuMP/qhoVb/src/_Derivatives/linearity.jl:42
 [3] JuMP._SubexpressionStorage(::Array{JuMP._Derivatives.NodeData,1}, ::Array{Float64,1}, ::Int64, ::Array{JuMP._Derivatives.Linearity,1}, ::Dict{MathOptInterface.VariableIndex,Int64}) at /Users/oscar/.julia/packages/JuMP/qhoVb/src/nlp.jl:300
 [4] initialize(::NLPEvaluator, ::Array{Symbol,1}) at /Users/oscar/.julia/packages/JuMP/qhoVb/src/nlp.jl:363
 [5] optimize!(::Ipopt.Optimizer) at /Users/oscar/.julia/packages/Ipopt/bYzBL/src/MOI_wrapper.jl:1041
 [6] optimize!(::MathOptInterface.Bridges.LazyBridgeOptimizer{Ipopt.Optimizer}) at /Users/oscar/.julia/packages/MathOptInterface/k7UUH/src/Bridges/bridge_optimizer.jl:264
 [7] optimize!(::MathOptInterface.Utilities.CachingOptimizer{MathOptInterface.AbstractOptimizer,MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.Model{Float64}}}) at /Users/oscar/.julia/packages/MathOptInterface/k7UUH/src/Utilities/cachingoptimizer.jl:215
 [8] optimize!(::Model, ::Nothing; bridge_constraints::Bool, ignore_optimize_hook::Bool, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /Users/oscar/.julia/packages/JuMP/qhoVb/src/optimizer_interface.jl:130
 [9] optimize! at /Users/oscar/.julia/packages/JuMP/qhoVb/src/optimizer_interface.jl:106 [inlined] (repeats 2 times)
 [10] top-level scope at REPL[11]:1

Reported by @MFairley

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

1 participant