Skip to content

Commit 2ff9476

Browse files
authored
Merge pull request #264 from JuliaControl/debug_warn_cond
debug: do not warn `cond(H̃)` in `NonLinMPC` if `Ewt≠0`
2 parents 5fde281 + 541797e commit 2ff9476

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/controller/construct.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ at [`relaxŶ`](@ref), [`relaxΔU`](@ref) and [`relaxU`](@ref) documentation, re
586586
vector ``\mathbf{q̃}`` and scalar ``r`` need recalculation each control period ``k``, see
587587
[`initpred!`](@ref). ``r`` does not impact the minima position. It is thus useless at
588588
optimization but required to evaluate the minimal ``J`` value. A `@warn` will be displayed
589-
if the condition number `cond(H̃) warn_cond` and `transcription` is a `SingleShooting`
589+
if the condition number `cond(H̃) > warn_cond` and `transcription` is a `SingleShooting`
590590
(`warn_cond=Inf` for no warning).
591591
"""
592592
function init_quadprog(

src/controller/nonlinmpc.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ struct NonLinMPC{
103103
Eŝ, Fŝ, Gŝ, Jŝ, Kŝ, Vŝ, Bŝ,
104104
gc!, nc
105105
)
106-
= init_quadprog(model, transcription, weights, Ẽ, P̃Δu, P̃u)
106+
warn_cond = iszero(weights.E) ? 1e6 : Inf # condition number warning only if Ewt==0
107+
= init_quadprog(model, transcription, weights, Ẽ, P̃Δu, P̃u; warn_cond)
107108
# dummy vals (updated just before optimization):
108109
q̃, r = zeros(NT, size(H̃, 1)), zeros(NT, 1)
109110
Ks, Ps = init_stochpred(estim, Hp)

0 commit comments

Comments
 (0)