Passed
Push — master ( 9ff666...1a4396 )
by Simon
03:24
created

hyperactive.optimizers.monte_carlo.stochastic_tunneling.StochasticTunnelingOptimizer._init_opt_positioner()   A

Complexity

Conditions 1

Size

Total Lines 2
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 2
rs 10
c 0
b 0
f 0
cc 1
nop 2
1
# Author: Simon Blanke
2
# Email: [email protected]
3
# License: MIT License
4
5
6
import numpy as np
7
8
from .simulated_annealing import SimulatedAnnealingOptimizer
9
10
11
class StochasticTunnelingOptimizer(SimulatedAnnealingOptimizer):
12
    def __init__(self, _main_args_, _opt_args_):
13
        super().__init__(_main_args_, _opt_args_)
14
15
    def _accept(self, _p_):
16
        f_stun = 1 - np.exp(-self._opt_args_.gamma * self._score_norm(_p_))
17
        return np.exp(-f_stun / self.temp)
18