Genetic

todo

class blocksnet.method.genetic.genetic.Genetic(*, city_model: ~blocksnet.models.city.City, BLOCKS: ~pandas.core.frame.DataFrame = Empty DataFrame Columns: [] Index: [], PROVISION: ~blocksnet.method.provision.provision.Provision = None, SCENARIO: dict, BUILDING_OPTIONS: ~pandas.core.frame.DataFrame = Empty DataFrame Columns: [] Index: [], GA_PARAMS: dict = {'K_tournament': 3, 'crossover_type': 'scattered', 'keep_parents': 1, 'mutation_percent_genes': (90, 10), 'mutation_type': 'adaptive', 'num_generations': 2, 'num_parents_mating': 6, 'parallel_processing': 12, 'parent_selection_type': 'tournament', 'sol_per_pop': 10, 'stop_criteria': 'saturate_50'})[source]

Bases: BaseMethod

BLOCKS: DataFrame
PROVISION: Provision
SCENARIO: dict
BUILDING_OPTIONS: DataFrame
GA_PARAMS: dict
flatten_dict(services: dict) tuple[dict[str, float], pandas.core.frame.DataFrame][source]

Utility function for get flatten dictionary of services requriments

get_combinations(services_dict: dict, comb_len: int) list[source]

Determination of all possible combinations of services in the blocks, depending on the scenario

get_combinations_area(combinations: list, services_df: DataFrame) list[source]

Calculation area of services for combinations

updating_blocks_combinations(combinations_weights)[source]

Updating the block dataframe with possible combinations depending on the free area

get_building_options(combinations: list)[source]

Filtering unsuitable combinations and updating all possible

get_updated_blocks(building_options_ids, blocks_ids=None)[source]

Get updated blocks with calculated provision

fitness_func(ga_instance, solution, solution_idx)[source]

Fitness function for genetic algorithm

get_blocks(selected_blocks: list[blocksnet.models.city.Block])[source]
property ga_params
property bricks_dict
calculate(comb_len: int, selected_blocks: list[blocksnet.models.city.Block] | list[int] | None = None) GeoDataFrame[source]

Calculation of the optimal development option by services for blocks