| Total Complexity | 2 |
| Total Lines | 19 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 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 | from ...search import Search |
||
| 10 | |||
| 11 | |||
| 12 | class StochasticTunnelingOptimizer(SimulatedAnnealingOptimizer, Search): |
||
| 13 | def __init__(self, search_space, gamma=0.5, **kwargs): |
||
| 14 | super().__init__(search_space, **kwargs) |
||
| 15 | |||
| 16 | def _accept(self): |
||
| 17 | f_stun = 1 - np.exp(-self._opt_args_.gamma * self._score_norm()) |
||
| 18 | return np.exp(-f_stun / self.temp) |
||
| 19 |