Skip to content

JuMP.solution_summary crash with TIME_LIMIT and MOI.VectorNonLinearOracle set #509

@franckgaga

Description

@franckgaga

Hello JuMP-ers!

It would be a long-ish job for me to produce a MRE without ModelPredictiveControl.jl, but I'm fairly sure that's a bug in the new MOI oracle set of Ipopt.jl. Here a MRE with MPC.jl v1.12.0:

using JuMP
using ModelPredictiveControl

f(x,u,_,_) = 0.5*x + 0.5*u
h(x,_,_)   = x
Ts = 1e-6       # small value to hit TIME_LIMIT termination status
oracle = true   # crash with true, work with false
model = NonLinModel(f, h, Ts, 1, 1, 1, solver=nothing)
nmpc = setconstraint!(NonLinMPC(model; Hp=5, direct=false, oracle), ymax=[1])
moveinput!(nmpc, [0])
solution_summary(nmpc.optim)

giving the error:

┌ Warning: MPC termination status not OPTIMAL or LOCALLY_SOLVED: keeping solution anyway (more info in debug log)
│   status = TIME_LIMIT::TerminationStatusCode = 12
└ @ ModelPredictiveControl ~/.julia/dev/ModelPredictiveControl/src/controller/execute.jl:425
ERROR: BoundsError: attempt to access 1-element Vector{Float64} at index [2]
Stacktrace:
  [1] throw_boundserror(A::Vector{Float64}, I::Tuple{Int64})
    @ Base ./essentials.jl:15
  [2] getindex
    @ ./essentials.jl:919 [inlined]
  [3] #_manually_evaluated_primal_status##2
    @ ./none:-1 [inlined]
  [4] iterate
    @ ./generator.jl:48 [inlined]
  [5] _all
    @ ./anyall.jl:203 [inlined]
  [6] all
    @ ./anyall.jl:188 [inlined]
  [7] all(itr::Base.Generator{…})
    @ Base ./anyall.jl:80
  [8] _manually_evaluated_primal_status(model::IpoptMathOptInterfaceExt.Optimizer)
    @ IpoptMathOptInterfaceExt ~/.julia/packages/Ipopt/iBJpg/ext/IpoptMathOptInterfaceExt/MOI_wrapper.jl:1479
  [9] get(model::IpoptMathOptInterfaceExt.Optimizer, attr::MathOptInterface.PrimalStatus)
    @ IpoptMathOptInterfaceExt ~/.julia/packages/Ipopt/iBJpg/ext/IpoptMathOptInterfaceExt/MOI_wrapper.jl:1500
 [10] get(model::MathOptInterface.Utilities.CachingOptimizer{…}, attr::MathOptInterface.PrimalStatus)
    @ MathOptInterface.Utilities ~/.julia/packages/MathOptInterface/tVdNJ/src/Utilities/cachingoptimizer.jl:934
 [11] get(model::Model, attr::MathOptInterface.PrimalStatus)
    @ JuMP ~/.julia/packages/JuMP/vfM5V/src/optimizer_interface.jl:817
 [12] #primal_status#100
    @ ~/.julia/packages/JuMP/vfM5V/src/optimizer_interface.jl:841 [inlined]
 [13] primal_status
    @ ~/.julia/packages/JuMP/vfM5V/src/optimizer_interface.jl:840 [inlined]
 [14] #has_values#32
    @ ~/.julia/packages/JuMP/vfM5V/src/variables.jl:2138 [inlined]
 [15] has_values
    @ ~/.julia/packages/JuMP/vfM5V/src/variables.jl:2137 [inlined]
 [16] solution_summary(model::Model; result::Int64, verbose::Bool)
    @ JuMP ~/.julia/packages/JuMP/vfM5V/src/solution_summary.jl:93
 [17] solution_summary(model::Model)
    @ JuMP ~/.julia/packages/JuMP/vfM5V/src/solution_summary.jl:87
 [18] top-level scope
    @ ~/Dropbox/Programmation/Julia/TestMPC/src/debug_jump.jl:11
Some type information was truncated. Use `show(err)` to see complete types.

It work as intended with oracle=false that is without using the new VectorNonlinearOracle.

Thanks for everything 😃 !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions