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