Operators
Crossovers, mutations and selections operations.
Crossovers
- gefest.core.opt.operators.crossovers.crossover_structures(structure1: Structure, structure2: Structure, domain: Domain, operations: list[Callable], operation_chance: float, operations_probs: list[int], **kwargs) tuple[Structure][source]
Applys random crossover from given list for pair of structures.
- Parameters:
- Returns:
Сhildren.
- Return type:
tuple[Structure]
- gefest.core.opt.operators.crossovers.panmixis(pop: list[Structure]) list[tuple[Structure, Structure]][source]
Default pair selection strategy.
- gefest.core.opt.operators.crossovers.structure_level_crossover(s1: Structure, s2: Structure, domain: Domain, **kwargs)[source]
Exchanges points of two polygons.
- gefest.core.opt.operators.crossovers.polygon_level_crossover(s1: Structure, s2: Structure, domain: Domain, **kwargs)[source]
Exchanges points of two nearest polygons in structure.
- class gefest.core.opt.operators.crossovers.CrossoverTypes(value)[source]
Bases:
EnumEnumerates all crossover functions.
- structure_level(*args, **kwargs) = functools.partial(<function structure_level_crossover>)
- polygon_level(*args, **kwargs) = functools.partial(<function polygon_level_crossover>)
Mutations
- gefest.core.opt.operators.mutations.mutate_structure(structure: Structure, domain: Domain, operations: list[Callable], operation_chance: float, operations_probs: list[float], **kwargs) Structure[source]
Applys random mutation from given list for each polygon in structure.
- Parameters:
- Returns:
- Mutated structure. It is not guaranteed
that the resulting structure will be valid or changed.
- Return type:
- gefest.core.opt.operators.mutations.rotate_poly_mutation(new_structure: Structure, domain: Domain, idx_: int = None, **kwargs) Structure[source]
Rotares polygon for random angle.
- gefest.core.opt.operators.mutations.drop_poly_mutation(new_structure: Structure, domain: Domain, idx_: int = None, **kwargs) Structure[source]
Drops random polygon from structure.
- gefest.core.opt.operators.mutations.add_poly_mutation(new_structure: Structure, domain: Domain, idx_: int = None, **kwargs) Structure[source]
Adds random polygon into structure using standard generator.
- gefest.core.opt.operators.mutations.resize_poly_mutation(new_structure: Structure, domain: Domain, idx_: int = None, **kwargs) Structure[source]
Randomly resizes polygon.
- gefest.core.opt.operators.mutations.pos_change_point_mutation(new_structure: Structure, domain: Domain, idx_: int = None, **kwargs) Structure[source]
Moves a random point without violating the geometry type specified in the domain.
- gefest.core.opt.operators.mutations.add_point_mutation(new_structure: Structure, domain: Domain, idx_: int = None, **kwargs)[source]
Adds a random point without violating the geometry type specified in the domain.
- gefest.core.opt.operators.mutations.drop_point_mutation(new_structure: Structure, domain: Domain, idx_: int = None, **kwargs)[source]
Drops random point from polygon.
- class gefest.core.opt.operators.mutations.MutationTypes(value)[source]
Bases:
Enumenumerates all mutation functions.
- rotate_poly(*args, **kwargs) = functools.partial(<function rotate_poly_mutation>)
- resize_poly(*args, **kwargs) = functools.partial(<function resize_poly_mutation>)
- add_point(*args, **kwargs) = functools.partial(<function add_point_mutation>)
- drop_point(*args, **kwargs) = functools.partial(<function drop_point_mutation>)
- add_poly(*args, **kwargs) = functools.partial(<function add_poly_mutation>)
- drop_poly(*args, **kwargs) = functools.partial(<function drop_poly_mutation>)
- pos_change_point(*args, **kwargs) = functools.partial(<function pos_change_point_mutation>)
Selections
- gefest.core.opt.operators.selections.roulette_selection(pop: list[Structure], pop_size: int, **kwargs) list[Structure][source]
Selects the best ones from provided population.
- gefest.core.opt.operators.selections.tournament_selection(pop: list[Structure], pop_size: int, fraction: float = 0.1, **kwargs) list[Structure][source]
Selects the best ones from provided population.
- class gefest.core.opt.operators.selections.SelectionTypes(value)[source]
Bases:
EnumEnumerates all GEFEST selection functions.
- roulette_selection(*args, **kwargs) = functools.partial(<function roulette_selection>)
- tournament_selection(*args, **kwargs) = functools.partial(<function tournament_selection>)