1
+ using Revise, Test
2
+ using IntervalMDPAbstractions, LazySets
3
+
4
+ @testset " gaussian" begin
5
+ w_stddev = [- 0.1 , 0.1 ]
6
+ @test_throws ArgumentError AdditiveDiagonalGaussianNoise (w_stddev)
7
+
8
+ w_stddev = [0.5 , 0.7 ]
9
+ w = AdditiveDiagonalGaussianNoise (w_stddev)
10
+
11
+ @test IntervalMDPAbstractions. dim (w) == 2
12
+ @test IntervalMDPAbstractions. stddev (w) == w_stddev
13
+ @test IntervalMDPAbstractions. candecouple (w) == true
14
+
15
+ @testset " transition_prob_bounds" begin
16
+ Y = Hyperrectangle (low= [0.0 , 0.0 ], high= [1.0 , 1.0 ])
17
+ Z = Hyperrectangle (low= [1.0 , 0.0 ], high= [2.0 , 1.0 ])
18
+
19
+ pl, pu = IntervalMDPAbstractions. axis_transition_prob_bounds (Y, Z, w, 1 )
20
+ @test pl ≈ 0.02271846070634608727902886
21
+ @test pu ≈ 0.47724986805182079279971736
22
+
23
+ pl, pu = IntervalMDPAbstractions. axis_transition_prob_bounds (Y, Z, w, 2 )
24
+ @test pl ≈ 0.42343627449016523494358104
25
+ @test pu ≈ 0.52494947594604699843798632
26
+
27
+ pl, pu = IntervalMDPAbstractions. transition_prob_bounds (Y, Z, w)
28
+ @test pl ≈ 0.00961982036364639498159342
29
+ @test pu ≈ 0.25053206812912340314964549
30
+ end
31
+
32
+ @testset " transition_prob_bounds not hyperrectangular" begin
33
+ Y = VPolytope ([[0.5 , 0.0 ], [1.0 , 0.7 ], [0.0 , 1.0 ]])
34
+ Z = Hyperrectangle (low= [1.0 , 0.0 ], high= [2.0 , 1.0 ])
35
+
36
+ pl, pu = IntervalMDPAbstractions. transition_prob_bounds (Y, Z, w)
37
+ @test pl ≈ 0.00961982036364639498159342
38
+ @test pu ≈ 0.25053206812912340314964549
39
+ end
40
+ end
41
+
42
+ @testset " centrally uniform" begin
43
+ r = [- 0.1 , 0.1 ]
44
+ @test_throws ArgumentError AdditiveCentralUniformNoise (r)
45
+
46
+ r = [0.5 , 0.7 ]
47
+ w = AdditiveCentralUniformNoise (r)
48
+
49
+ @test IntervalMDPAbstractions. dim (w) == 2
50
+ @test IntervalMDPAbstractions. candecouple (w) == true
51
+
52
+ @testset " transition_prob_bounds" begin
53
+ Y = Hyperrectangle (low= [0.0 , 0.0 ], high= [1.0 , 1.0 ])
54
+ Z = Hyperrectangle (low= [1.0 , 0.0 ], high= [2.0 , 1.0 ])
55
+
56
+ pl, pu = IntervalMDPAbstractions. axis_transition_prob_bounds (Y, Z, w, 1 )
57
+ @test pl ≈ 0.0
58
+ @test pu ≈ 0.5
59
+
60
+ pl, pu = IntervalMDPAbstractions. axis_transition_prob_bounds (Y, Z, w, 2 )
61
+ @test pl ≈ 0.5
62
+ @test pu ≈ 1.0 / 1.4
63
+
64
+ pl, pu = IntervalMDPAbstractions. transition_prob_bounds (Y, Z, w)
65
+ @test pl ≈ 0.0
66
+ @test pu ≈ 0.5 / 1.4
67
+ end
68
+
69
+ @testset " transition_prob_bounds not hyperrectangular" begin
70
+ Y = VPolytope ([[0.5 , 0.0 ], [1.0 , 0.7 ], [0.0 , 1.0 ]])
71
+ Z = Hyperrectangle (low= [1.0 , 0.0 ], high= [2.0 , 1.0 ])
72
+
73
+ pl, pu = IntervalMDPAbstractions. transition_prob_bounds (Y, Z, w)
74
+ @test pl ≈ 0.0
75
+ @test pu ≈ 0.5 / 1.4
76
+ end
77
+ end
0 commit comments