|
1
|
|
|
"""Module represent single stage in process.""" |
|
2
|
1 |
|
import numpy as np |
|
|
|
|
|
|
3
|
|
|
|
|
4
|
1 |
|
from grortir.main.model.core.optimization_status import OptimizationStatus |
|
5
|
|
|
|
|
6
|
|
|
|
|
7
|
|
|
# pylint: disable=too-many-instance-attributes |
|
|
|
|
|
|
8
|
|
|
|
|
9
|
|
|
|
|
10
|
1 |
|
class AbstractStage: |
|
11
|
|
|
"""Class represent single stage in process. |
|
12
|
|
|
|
|
13
|
|
|
Attributes: |
|
14
|
|
|
input_vector (list): initial vector |
|
15
|
|
|
optimization_status (OptimizationStatus): status of optimization |
|
16
|
|
|
control_params (list): actual control params |
|
17
|
|
|
lower_bounds (list): lower bounds for control params |
|
18
|
|
|
upper_bounds (list): upper bounds for control params |
|
19
|
|
|
|
|
20
|
|
|
""" |
|
21
|
|
|
|
|
22
|
1 |
|
def __init__(self, input_vector=()): |
|
23
|
|
|
"""Constructor. |
|
24
|
|
|
|
|
25
|
|
|
Args: |
|
26
|
|
|
input_vector (tuple): initial vector |
|
27
|
|
|
""" |
|
28
|
1 |
|
self.input_vector = input_vector |
|
29
|
1 |
|
self.optimization_status = OptimizationStatus.not_started |
|
30
|
1 |
|
self.control_params = np.zeros_like(input_vector) |
|
31
|
1 |
|
dimensions = len(input_vector) |
|
32
|
1 |
|
self.lower_bounds = [-1] * dimensions |
|
33
|
1 |
|
self.upper_bounds = [1] * dimensions |
|
34
|
1 |
|
self.final_output = None |
|
35
|
1 |
|
self.final_quality = None |
|
36
|
1 |
|
self.final_cost = None |
|
37
|
|
|
|
|
38
|
1 |
|
@staticmethod |
|
39
|
|
|
def get_cost(): |
|
40
|
|
|
"""Return cost of stage.""" |
|
41
|
1 |
|
raise NotImplementedError |
|
42
|
|
|
|
|
43
|
1 |
|
@staticmethod |
|
44
|
1 |
|
def get_quality(input_vector=None, control_params=None): |
|
45
|
|
|
"""Return quality of stage.""" |
|
46
|
1 |
|
raise NotImplementedError |
|
47
|
|
|
|
|
48
|
1 |
|
@staticmethod |
|
49
|
|
|
def could_be_optimized(): |
|
50
|
|
|
"""Return answer if it is still possible to optimize that stage.""" |
|
51
|
1 |
|
raise NotImplementedError |
|
52
|
|
|
|
|
53
|
1 |
|
@staticmethod |
|
54
|
|
|
def is_enough_quality(value): |
|
55
|
|
|
"""Return True if value is enough quality.""" |
|
56
|
1 |
|
raise NotImplementedError |
|
57
|
|
|
|
|
58
|
1 |
|
@staticmethod |
|
59
|
|
|
def get_output_of_stage(): |
|
60
|
|
|
"""Result of processing input with current control params.""" |
|
61
|
1 |
|
raise NotImplementedError |
|
62
|
|
|
|
|
63
|
1 |
|
@staticmethod |
|
64
|
|
|
def get_maximal_acceptable_cost(): |
|
65
|
|
|
"""Return maximum acceptable cost.""" |
|
66
|
|
|
raise NotImplementedError |
|
67
|
|
|
|
This can be caused by one of the following:
1. Missing Dependencies
This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.
2. Missing __init__.py files
This error could also result from missing
__init__.pyfiles in your module folders. Make sure that you place one file in each sub-folder.