Passed
Push — master ( 07671f...674edd )
by Simon
03:40
created

BasePopulationOptimizer._iterations()   A

Complexity

Conditions 2

Size

Total Lines 6
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 5
nop 2
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
# Author: Simon Blanke
2
# Email: [email protected]
3
# License: MIT License
4
5
import numpy as np
6
from ...converter import Converter
7
from ...results_manager import ResultsManager
8
9
10
class BasePopulationOptimizer:
11
    def __init__(
12
        self,
13
        search_space,
14
        initialize={"grid": 4, "random": 2, "vertices": 4},
15
    ):
16
        super().__init__()
17
        self.conv = Converter(search_space)
18
        self.results_mang = ResultsManager(self.conv)
19
        self.initialize = initialize
20
21
        self.eval_times = []
22
        self.iter_times = []
23
24
    def _iterations(self, positioners):
25
        nth_iter = 0
26
        for p in positioners:
27
            nth_iter = nth_iter + len(p.pos_new_list)
28
29
        return nth_iter
30
31
    def finish_initialization(self):
32
        pass