Passed
Push — master ( 4ef66c...afb360 )
by Simon
03:52
created

tests.test_optimizers.test_RandomAnnealing   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 14
dl 0
loc 24
rs 10
c 0
b 0
f 0
wmc 4

2 Functions

Rating   Name   Duplication   Size   Complexity  
A test_annealing_rate() 0 4 2
A test_start_temp() 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 RandomAnnealingOptimizer
8
from ._base_test import _base_test
9
10
n_iter = 33
11
opt = RandomAnnealingOptimizer
12
13
14
def test_annealing_rate():
15
    for annealing_rate in [1, 0.001]:
16
        opt_para = {"annealing_rate": annealing_rate}
17
        _base_test(opt, n_iter, opt_para=opt_para)
18
19
20
def test_start_temp():
21
    for start_temp in [0.001, 10000]:
22
        opt_para = {"start_temp": start_temp}
23
        _base_test(opt, n_iter, opt_para=opt_para)
24