selector.generators.variable_graph_point_generator
This module contains the variable graph point generator.
Based on the variable tree in GGA [Ansótegui, C., Sellmann, M., Tierney, K.: A Gender-Based Genetic Algorithm for the Automatic Configuration of Algorithms. In: Principles and Practice of Constraint Programming - CP 2009. pp. 142–157 (09 2009).]
Functions
|
Check if parameter is actually set in Configuration. |
|
Pick configurations according to mode. |
|
Decide new label in case of label O. |
|
Crossover according to variable graph. |
|
Check if no goods are violated and change value if so. |
|
Set label. |
|
Configuration is generated via variable graph method. |
General variable graph structure is read from scenario. |
Classes
|
Contains the types of labels a node can assume. |
|
Contains the types of modes for choosing parent configurations. |
- class selector.generators.variable_graph_point_generator.LabelType(value)[source]
Bases:
IntEnumContains the types of labels a node can assume.
- C = 1
- N = 2
- O = 3
- class selector.generators.variable_graph_point_generator.Mode(value)[source]
Bases:
EnumContains the types of modes for choosing parent configurations.
- best_and_random = 3
- only_best = 2
- random = 1
- selector.generators.variable_graph_point_generator.check_valid(config_label, C, N, cn)[source]
Check if parameter is actually set in Configuration.
- Parameters:
config_label (dict) – Current labeling of parameters.
C (dict) – First configuration.
N (dict) – Second configuration.
- Returns:
Updated configuration label.
- Return type:
dict
- selector.generators.variable_graph_point_generator.choose_parents(mode, data, lookback, results)[source]
Pick configurations according to mode.
- Parameters:
mode (selector.generators.variable_graph_point_generator.Mode) – Mode of parent selection.
data (dict of selector.pool.Tournament) – Tournament data to select parents from.
lookback (int) – Number of past tournaments included.
- Returns:
C : dict, Configuration C.
N : dict, Configuration N.
- Return type:
tuple
- selector.generators.variable_graph_point_generator.decide_for_O(config_label, C, N, cn)[source]
Decide new label in case of label O.
- Parameters:
config_label (dict) – Current labeling of parameters.
C (dict) – First configuration.
N (dict) – Second configuration.
cn (str) – Child node in the graph.
- Returns:
Updated configuration label.
- Return type:
dict
- selector.generators.variable_graph_point_generator.graph_crossover(graph_structure, C, N, s)[source]
Crossover according to variable graph.
- Parameters:
graph_structure (dict of list) – General variable graph structure.
C (dict) – Configuration 1.
N (dict) – Configuration 2.
s (selector.scenario.Scenario) – AC scenario.
- Returns:
New configuration setting.
- Return type:
dict
- selector.generators.variable_graph_point_generator.reset_no_goods(s, config_setting, label, C, N)[source]
Check if no goods are violated and change value if so.
- Parameters:
s (selector.scenario.Scenario) – AC scenario.
config_setting (dict) – Parameter value setting.
label (str) – Label.
C (dict) – First configuration.
N (dict) – Second configuration.
- Returns:
Updated config_setting.
- Return type:
dict
- selector.generators.variable_graph_point_generator.set_config_label(paths, config_label, cn, C, N)[source]
Set label.
- Parameters:
paths (dict) – Nodes visited until the current node.
config_label (selector.generators.variable_graph_point_generator.LabelType) – Current labeling.
cn (str) – Current node.
C (dict) – First configuration.
N (dict) – Second configuration.
- Returns:
Updated config_label.
- Return type:
dict
- selector.generators.variable_graph_point_generator.variable_graph_point(s, identity, results, mode=Mode.best_and_random, alldata=False, lookback=1, seed=False)[source]
Configuration is generated via variable graph method.
- Parameters:
s (selector.scenario.Scenario) – AC scenario.
identity (uuid.UUID) – UUID to identify configuration.
mode (selector.generators.variable_graph_point_generator.Mode) – Mode of parent selection.
data (dict of selector.pool.Tournament) – Tournament data to select parents from.
lookback (int) – Number of past tournaments included.
seed (int) – Random seed.
- Returns:
Configuration generated with GGA graph.
- Return type:
- selector.generators.variable_graph_point_generator.variable_graph_structure(s)[source]
General variable graph structure is read from scenario.
- Parameters:
s (selector.scenario.Scenario) – AC scenario.
- Returns:
General variable graph structure.
- Return type:
dict of lists