Passed
Push — master ( 44bd28...268666 )
by Simon
03:57
created

tests.test_optimizer_parameter.test_TabuSearch   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 18
dl 0
loc 30
rs 10
c 0
b 0
f 0
wmc 6

3 Functions

Rating   Name   Duplication   Size   Complexity  
A test_n_neighbours() 0 4 2
A test_epsilon() 0 4 2
A test_tabu_factor() 0 4 2
1
# Author: Simon Blanke
2
# Email: [email protected]
3
# License: MIT License
4
5
import numpy as np
6
7
from gradient_free_optimizers import TabuOptimizer
8
from ._base_test import _base_test
9
10
n_iter = 33
11
opt = TabuOptimizer
12
13
14
def test_epsilon():
15
    for epsilon in [0.00001, 100]:
16
        opt_para = {"epsilon": epsilon}
17
        _base_test(opt, n_iter, opt_para=opt_para)
18
19
20
def test_n_neighbours():
21
    for n_neighbours in [1, 100]:
22
        opt_para = {"n_neighbours": n_neighbours}
23
        _base_test(opt, n_iter, opt_para=opt_para)
24
25
26
def test_tabu_factor():
27
    for tabu_factor in [1, 3, 20, 50, 100]:
28
        opt_para = {"tabu_factor": tabu_factor}
29
        _base_test(opt, n_iter, opt_para=opt_para)
30