Skip to content

DAQP v0.3.3 crashes on Julia 1.10 with KeyError: key 0 not found #105

@franckgaga

Description

@franckgaga

Hello,

This MRE crashes on Julia v1.10 (LTS) since the last update (v0.3.3, PR #104 ):

using ModelPredictiveControl, ControlSystemsBase, LinearAlgebra
using JuMP, DAQP

Ts = 400.0
sys = [ tf(1.90,[1800.0,1])   tf(1.90,[1800.0,1])   tf(1.90,[1800.0,1]);
        tf(-0.74,[800.0,1])   tf(0.74,[800.0,1])    tf(-0.74,[800.0,1])   ]

linmodel = LinModel(sys,Ts,i_u=[1,2], i_d=[3])
linmodel = setop!(linmodel, uop=[10,50], yop=[50,30], dop=[5])

Q̂ = diagm([1/4, 1/4, 1/4, 1/4].^2) 
R̂ = diagm([1, 1].^2)
optim = Model(DAQP.Optimizer)
covestim = SteadyKalmanFilter(linmodel, 1:2, 0, 0, Q̂, R̂)
P̂_0 = covestim.cov.P̂

mhe3 = MovingHorizonEstimator(linmodel, 2, 1:2, 0, 0, P̂_0, Q̂, R̂; optim, covestim)
preparestate!(mhe3, [50, 30], [5])

resulting in:

┌ Warning: The objective is not strictly convex, updating settings with eps_prox=1.0e-7
└ @ DAQP ~/.julia/packages/DAQP/h790x/src/MOI_wrapper/MOI_wrapper.jl:321
ERROR: KeyError: key 0 not found
Stacktrace:
  [1] getindex
    @ ./dict.jl:498 [inlined]
  [2] solve
    @ ~/.julia/packages/DAQPBase/iq2zF/src/api.jl:203 [inlined]
  [3] optimize!(optimizer::Optimizer)
    @ DAQP ~/.julia/packages/DAQP/h790x/src/MOI_wrapper/MOI_wrapper.jl:109
  [4] optimize!
    @ ~/.julia/packages/MathOptInterface/03Qtw/src/MathOptInterface.jl:122 [inlined]
  [5] optimize!(m::MathOptInterface.Utilities.CachingOptimizer{Optimizer, MathOptInterface.Utilities.UniversalFallback{…}})
    @ MathOptInterface.Utilities ~/.julia/packages/MathOptInterface/03Qtw/src/Utilities/cachingoptimizer.jl:370
  [6] optimize!
    @ ~/.julia/packages/MathOptInterface/03Qtw/src/Bridges/bridge_optimizer.jl:367 [inlined]
  [7] optimize!
    @ ~/.julia/packages/MathOptInterface/03Qtw/src/MathOptInterface.jl:122 [inlined]
  [8] optimize!(m::MathOptInterface.Utilities.CachingOptimizer{…})
    @ MathOptInterface.Utilities ~/.julia/packages/MathOptInterface/03Qtw/src/Utilities/cachingoptimizer.jl:370
  [9] optimize!(model::Model; ignore_optimize_hook::Bool, _differentiation_backend::MathOptInterface.Nonlinear.SparseReverseMode, kwargs::@Kwargs{})
    @ JuMP ~/.julia/packages/JuMP/e83v9/src/optimizer_interface.jl:609
 [10] optimize!
    @ ~/.julia/packages/JuMP/e83v9/src/optimizer_interface.jl:560 [inlined]
 [11] optim_objective!(estim::MovingHorizonEstimator{…})
    @ ModelPredictiveControl ~/.julia/packages/ModelPredictiveControl/BbvDn/src/estimator/mhe/execute.jl:482
 [12] correct_estimate!
    @ ~/.julia/packages/ModelPredictiveControl/BbvDn/src/estimator/mhe/execute.jl:37 [inlined]
 [13] preparestate!(estim::MovingHorizonEstimator{…}, ym::Vector{…}, d::Vector{…})
    @ ModelPredictiveControl ~/.julia/packages/ModelPredictiveControl/BbvDn/src/estimator/execute.jl:297
 [14] top-level scope
    @ ~/Dropbox/Programmation/Julia/TestMPC/src/debug_daqp.jl:18
Some type information was truncated. Use `show(err)` to see complete types.

It was working well with DAQP v0.3.2.

Thanks for your time!

edit : and it also works well on the current stable version of Julia v1.12. It shows the warning about convexity but the problem is solved successfully nonetheless.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions