Total Complexity | 3 |
Total Lines | 17 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | """Contain PsoAlgorithm.""" |
||
7 | class PsoAlgorithm: |
||
8 | """Optimize process with different strategies.""" |
||
9 | |||
10 | def __init__(self, process, strategy, number_of_particle = 40): |
||
|
|||
11 | self.process = process |
||
12 | self.strategy = strategy |
||
13 | self.processValidator = ProcessValidator() |
||
14 | self.whole_group_pso = WholeGroupPso(self.process, number_of_particle) |
||
15 | |||
16 | def run(self): |
||
17 | self.processValidator.validate(self.process) |
||
18 | self.process.optimizationStatus = OptimizationStatus.in_progress |
||
19 | number_of_groups = self.strategy.get_actual_numbers_of_groups() |
||
20 | for current_group_number in range(number_of_groups): |
||
21 | current_stages = self.strategy.get_items_from_group( |
||
22 | current_group_number) |
||
23 | self.whole_group_pso.optimize(current_stages) |
||
24 | |||
25 |