Skip to content

Commit 6d64fde

Browse files
committed
add numerical challenge problem to tests
1 parent badc872 commit 6d64fde

3 files changed

Lines changed: 22 additions & 3 deletions

File tree

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ UnPack = "1.0"
4141
julia = "1.6"
4242

4343
[extras]
44-
GenericLinearAlgebra = "14197337-ba66-59df-a3e3-ca00e7dcff7a"
4544
FiniteDiff = "6a86dc24-6348-571c-b903-95158fe2bd41"
45+
GenericLinearAlgebra = "14197337-ba66-59df-a3e3-ca00e7dcff7a"
4646
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
4747
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
4848
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"

src/hinfinity_design.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ function hinfsynthesize(
158158
_γiterations(P̄, interval, verbose, gtol, tolerance)
159159

160160

161-
if !isempty(γFeasible)
161+
if γFeasible !== nothing
162162
# Synthesize the controller and transform it back into the original coordinates
163163

164164
if γrel > 1
@@ -448,7 +448,7 @@ function _γiterations(
448448

449449
T = typeof(P.A)
450450
XinfFeasible, YinfFeasible, FinfFeasible, HinfFeasible, gammFeasible =
451-
T(undef,0,0), T(undef,0,0), T(undef,0,0), T(undef,0,0), typemax(interval[2])
451+
T(undef,0,0), T(undef,0,0), T(undef,0,0), T(undef,0,0), nothing
452452

453453
gl, gu = interval
454454
gl = max(1e-3, gl)

test/test_hinf_design.jl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -851,3 +851,22 @@ end
851851
end
852852
end
853853

854+
855+
@testset "Numerical difficulties" begin
856+
## Numerically difficult problem instance
857+
Gsyn3A = [0.0 1.0 0.0; -1.2000000000000002e-6 -0.12000999999999999 0.0; -11.2 -0.0 -2.0e-7]
858+
Gsyn3B = [0.0 0.0; 0.0 1.0; 1.0 0.0]
859+
Gsyn3C = [-7.466666666666666 -0.0 19.999999866666666; 0.0 0.0 0.0; -11.2 -0.0 0.0]
860+
Gsyn3D = [0.6666666666666666 0.0; 0.0 1.0; 1.0 -0.0]
861+
Gsyn3 = ss(Gsyn3A, Gsyn3B, Gsyn3C, Gsyn3D)
862+
Gsyn = partition(Gsyn3, 1, 2)
863+
K, γ = hinfsynthesize(Gsyn, ftype=BigFloat, γrel = 1)[1:2]
864+
@test_broken γ 4.4825150 atol=1e-2 # value by slicot
865+
@test γ 4.4825150 atol=2e-2 # slightly less strict test is passed
866+
867+
868+
Gsynb, _ = balance_statespace(Gsyn, false)
869+
K, γ = hinfsynthesize(Gsynb, ftype=BigFloat, γrel = 1)[1:2]
870+
@test_broken γ 4.4825150 atol=1e-2 # value by slicot
871+
@test γ 4.4825150 atol=2e-2 # slightly less strict test is passed
872+
end

0 commit comments

Comments
 (0)