Passed
Push — master ( 47a5a9...c39b55 )
by Simon
04:54
created

tests.test_verbosity.test_verbosity_4()   A

Complexity

Conditions 1

Size

Total Lines 6
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 6
nop 0
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
import numpy as np
2
3
from gradient_free_optimizers import RandomSearchOptimizer
4
5
6
def objective_function(para):
7
    score = -para["x1"] * para["x1"]
8
    return score
9
10
11
search_space = {
12
    "x1": np.arange(0, 100, 0.1),
13
}
14
15
16
def test_verbosity_0():
17
    opt = RandomSearchOptimizer(search_space)
18
    opt.search(objective_function, n_iter=100, verbosity=False)
19
20
21
def test_verbosity_1():
22
    opt = RandomSearchOptimizer(search_space,)
23
    opt.search(
24
        objective_function,
25
        n_iter=100,
26
        verbosity=["progress_bar", "print_results", "print_times"],
27
    )
28
29
30
def test_verbosity_2():
31
    opt = RandomSearchOptimizer(search_space)
32
    opt.search(
33
        objective_function,
34
        n_iter=100,
35
        verbosity=["print_results", "print_times"],
36
    )
37
38
39
def test_verbosity_3():
40
    opt = RandomSearchOptimizer(search_space)
41
    opt.search(
42
        objective_function,
43
        n_iter=100,
44
        verbosity=["progress_bar", "print_times"],
45
    )
46
47
48
def test_verbosity_4():
49
    opt = RandomSearchOptimizer(search_space)
50
    opt.search(
51
        objective_function,
52
        n_iter=100,
53
        verbosity=["progress_bar", "print_results"],
54
    )
55
56
57
def test_verbosity_5():
58
    opt = RandomSearchOptimizer(search_space)
59
    opt.search(objective_function, n_iter=100, verbosity=[])
60
61