@@ -113,7 +113,7 @@ struct LinMPC <: PredictiveController
113113 ŷs, Ŷs = zeros (ny), zeros (ny* Hp)
114114 nvar = size (P̃, 1 )
115115 optmodel = Model (OSQP. MathOptInterfaceOSQP. Optimizer) # default to OSQP solver
116- set_attribute (optmodel, " verbose " , false )
116+ set_silent (optmodel)
117117 @variable (optmodel, ΔŨ[1 : nvar])
118118 # dummy q̃ value (the vector is updated just before optimization):
119119 q̃ = zeros (nvar)
@@ -124,7 +124,7 @@ struct LinMPC <: PredictiveController
124124 i_nonInf = .! isinf .(b)
125125 A = A[i_nonInf, :]
126126 b = b[i_nonInf]
127- @constraint (optmodel, constraint_lin, A* ΔŨ .≤ b)
127+ @constraint (optmodel, constraint_lin, A* ΔŨ .≤ b)
128128 optim = OptimData (optmodel, 0 , zeros (nvar), ϵ, u, U, ŷ, Ŷ, ŷs, Ŷs)
129129 return new (
130130 model, estim, optim,
@@ -576,14 +576,13 @@ function optim_objective!(mpc::LinMPC, b, q̃, p)
576576 ϵ = isinf (mpc. C) ? nothing : ΔŨ[end ]
577577 J = objective_value (mpc. optim. model) + p # optimal objective value by adding constant p
578578 status = termination_status (mpc. optim. model)
579- if status ≠ MOI . OPTIMAL && status ≠ MOI . LOCALLY_SOLVED
579+ if status ≠ OPTIMAL && status ≠ LOCALLY_SOLVED
580580 @warn " MPC termination status not optimal ($status )"
581581 end
582582 # if error, we take last value :
583- if any (status .== [MOI. INFEASIBLE, MOI. DUAL_INFEASIBLE, MOI. LOCALLY_INFEASIBLE,
584- MOI. SLOW_PROGRESS, MOI. NUMERICAL_ERROR,
585- MOI. INVALID_MODEL, MOI. INVALID_OPTION, MOI. INTERRUPTED,
586- MOI. OTHER_ERROR])
583+ if any (status .== [INFEASIBLE, DUAL_INFEASIBLE, LOCALLY_INFEASIBLE, SLOW_PROGRESS,
584+ NUMERICAL_ERROR, INVALID_MODEL, INVALID_OPTION, INTERRUPTED,
585+ OTHER_ERROR])
587586 ΔŨ = ΔŨ0
588587 end
589588 return ΔŨ, ϵ, J
0 commit comments