/
test_bands.jl
43 lines (41 loc) · 1.05 KB
/
test_bands.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
res1 = get_interval(
[3.0],
(x)->x[1]^2,
f_1p,
:CICO_ONE_PASS;
scan_bounds=(1e-9,1e9),
#theta_bounds = [(1e-2,1e2)],
loss_crit = 8.,
local_alg = :LN_NELDERMEAD,
silent = true
)
@test isapprox(res1.result[1].value, (3-sqrt(3))^2,atol=1e-2)
@test isapprox(res1.result[2].value, (3+sqrt(3))^2,atol=1e-2)
res2 = get_interval(
[3.0],
(x)->x[1]^2,
f_1p,
:CICO_ONE_PASS;
scan_bounds=(1e-9,1e9),
#theta_bounds = [(1e-2,1e2)],
loss_crit = 8.,
local_alg = :LD_MMA,
silent = true,
loss_grad = :AUTODIFF
)
@test isapprox(res2.result[1].value, (3-sqrt(3))^2,atol=1e-2)
@test isapprox(res2.result[2].value, (3+sqrt(3))^2,atol=1e-2)
res3 = get_interval(
[3.0],
(x) -> log10(x[1]^2),
f_1p,
:CICO_ONE_PASS,
scan_bounds=(1e-9,1e9),
#theta_bounds = [(1e-2,1e2)],
loss_crit = 8.,
local_alg = :LD_MMA,
silent = true,
loss_grad = :AUTODIFF
)
@test isapprox(res3.result[1].value, 2*log10(3-sqrt(3)),atol=1e-2)
@test isapprox(res3.result[2].value, 2*log10(3+sqrt(3)),atol=1e-2)