Completed
Pull Request — master (#40)
by Wojtek
07:52
created

GroupedOptimizer.__init__()   A

Complexity

Conditions 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
1
"""Basic grouped optimizer."""
2
import networkx as nx
0 ignored issues
show
Configuration introduced by
The import networkx could not be resolved.

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.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
3
4
5
class GroupedOptimizer(object):
6
    """Optimizer is object which optimize process."""
7
8
    def __init__(self, process):
9
        self.process = process
10
        self.ordered_stages = nx.topological_sort(self.process)
11
        self.swarm_size = 40
12
13
    def set_custom_optimizing_order(self, ordered_stages):
14
        """Set custom order."""
15
        if set(self.ordered_stages) == set(ordered_stages) and len(
16
                self.ordered_stages) == len(ordered_stages):
17
            self.ordered_stages = ordered_stages
18
        else:
19
            raise ValueError("List of stages must contain all stages.")
20
21
    def optimize_process(self):
22
        """Optimize process.
23
        Returns:
24
            True if success, False otherwise."""
25
        pass
26