| Conditions | 5 |
| Total Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 5 |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | """Basic optimizer.""" |
||
| 11 | 1 | def optimize_process(self): |
|
| 12 | 1 | """Optimize process. |
|
| 13 | 1 | Raises: |
|
| 14 | 1 | AttributeError: When project has incorrect structure. |
|
| 15 | |||
| 16 | 1 | Returns: |
|
| 17 | bool: True if success, False otherwise.""" |
||
| 18 | 1 | for stage in self.ordered_stages: |
|
| 19 | if not self.process.predecessors(stage): |
||
| 20 | 1 | self.run_pso(stage) |
|
| 21 | elif len(self.process.predecessors(stage)) == 1: |
||
| 22 | 1 | predecessor = self.process.predecessors(stage)[0] |
|
| 23 | stage.input_vector = predecessor.get_output_of_stage() |
||
| 24 | 1 | self.run_pso(stage) |
|
| 25 | else: |
||
| 26 | raise AttributeError('Incorrect process structure.') |
||
| 27 | |||
| 28 | if stage.optimization_status != OptimizationStatus.success: |
||
| 29 | return False |
||
| 30 | return True |
||
| 31 | 1 | ||
| 35 |