Passed
Push — master ( c5e615...300275 )
by Simon
01:59 queued 13s
created

gaussian()   A

Complexity

Conditions 1

Size

Total Lines 5
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nop 3
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
# Author: Simon Blanke
2
# Email: [email protected]
3
# License: MIT License
4
5
import random
6
import numpy as np
7
8
9
from . import HillClimbingOptimizer
10
from ...search import Search
11
from scipy.spatial.distance import euclidean
12
13
14
class TabuOptimizer(HillClimbingOptimizer, Search):
15
    def __init__(self, search_space, tabu_factor=3):
16
        super().__init__(search_space)
17
18
        self.tabus = []
19
        self.tabu_factor = tabu_factor
20
        self.epsilon_mod = 1
21
22
    @HillClimbingOptimizer.iter_dec
23
    def iterate(self):
24
        return self._move_climb(self.pos_current)
25
26
    def evaluate(self, score_new):
27
        super().evaluate(score_new)
28
29
        if score_new <= self.score_current:
30
            self.epsilon_mod = self.tabu_factor
31
        else:
32
            self.epsilon_mod = 1
33
34