Module Expr Str Import alias Import alias ImportFrom alias ImportFrom alias ImportFrom alias ClassDef bases AttributeLoad NameLoad attr body FunctionDef arguments args NameParam defaults body Expr Str Assign AttributeStore NameLoad attr ListLoad TupleLoad Str Num TupleLoad Str Num TupleLoad Str Num TupleLoad Str Num TupleLoad Str Num Assign NameStore Call AttributeLoad NameLoad attr ListLoad Num Num Num Num Num Assign NameStore Call AttributeLoad NameLoad attr ListLoad Num Num Num Num Num Assign NameStore Call AttributeLoad NameLoad attr ListLoad Num Num Num Num Num Assign NameStore Call AttributeLoad NameLoad attr ListLoad Num Num Num Num Num Assign AttributeStore NameLoad attr ListLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign AttributeStore AttributeLoad NameLoad attr attr Num Assign AttributeStore AttributeLoad NameLoad attr attr Num Assign AttributeStore AttributeLoad NameLoad attr attr Lambda arguments args NameParam NameParam defaults Call NameLoad ListComp NameLoad comprehension TupleStore NameStore TupleStore NameStore NameStore Call NameLoad NameLoad NameLoad BoolOpAnd NameLoad CompareEq Call AttributeLoad NameLoad attr Num Num Assign AttributeStore AttributeLoad NameLoad attr attr AttributeLoad AttributeLoad NameLoad attr attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assert CompareEq AttributeLoad NameLoad attr Num Assert CompareEq AttributeLoad NameLoad attr Num Assert CompareIs AttributeLoad NameLoad attr NameLoad Assert CompareEq AttributeLoad NameLoad attr Num Assert CompareEq AttributeLoad NameLoad attr Num decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr keyword Num keyword Num keyword Num keyword Num Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign TupleStore NameStore NameStore SubscriptLoad AttributeLoad NameLoad attr Index Num Assert CompareEq Call NameLoad AttributeLoad NameLoad attr Num Assert CompareEq TupleLoad NameLoad NameLoad TupleLoad Str Num Assert CompareEq AttributeLoad NameLoad attr Num Assert CompareEq AttributeLoad NameLoad attr Num Assert CompareIs AttributeLoad NameLoad attr NameLoad Assert CompareIs AttributeLoad NameLoad attr NameLoad Assert CompareEq AttributeLoad NameLoad attr Num Assert CompareEq AttributeLoad NameLoad attr Num decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr ListLoad Str Str Str Assert CompareEq AttributeLoad NameLoad attr ListLoad Str Str Str Assert CompareEq AttributeLoad NameLoad attr Num Assert CompareEq Call NameLoad NameLoad Str decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr ListLoad Str Str Str Assign AttributeStore NameLoad attr Num Assert CompareEq AttributeLoad NameLoad attr ListLoad Str Str Str Assert CompareEq AttributeLoad NameLoad attr Num Assert CompareEq Call NameLoad NameLoad Str decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore AttributeLoad AttributeLoad NameLoad attr attr Assert CompareEq Call NameLoad ListLoad Num Num Num Num Num NameLoad Num Assert CompareEq Call NameLoad ListLoad Num Num Num Num Num NameLoad Num Assert CompareEq Call NameLoad ListLoad Num Num Num Num Num NameLoad Num Assert CompareEq Call NameLoad ListLoad Num Num Num Num Num NameLoad Num decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore ListLoad Num Num Num Num Num Assign NameStore ListLoad Num Num Num Num Num Assign NameStore Lambda arguments args NameParam NameParam defaults TupleLoad BinOpAdd SubscriptLoad NameLoad Slice Num SubscriptLoad NameLoad Slice Num BinOpAdd SubscriptLoad NameLoad Slice Num SubscriptLoad NameLoad Slice Num Assign AttributeStore AttributeLoad NameLoad attr attr NameLoad Assign TupleStore NameStore NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad Assert CompareEq NameLoad ListLoad Num Num Num Num Num Assert CompareEq NameLoad ListLoad Num Num Num Num Num decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore ListLoad Num Num Num Num Num Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign NameStore ListComp CompareEq NameLoad NameLoad comprehension TupleStore NameStore NameStore Call NameLoad NameLoad ListLoad Num Num Num Num Num Assert CompareNotEq NameLoad ListLoad Num Num Num Num Num Assert CompareEq Call AttributeLoad NameLoad attr NameLoad Num decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign AttributeStore AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr Assign AttributeStore AttributeLoad NameLoad attr attr Num Assign AttributeStore AttributeLoad NameLoad attr attr AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad AttributeLoad NameLoad attr attr Assert CompareEq AttributeLoad NameLoad attr ListLoad Num Num Num Num Num Assert CompareEq AttributeLoad NameLoad attr Num Assert CompareEq Call NameLoad AttributeLoad NameLoad attr Num Assert CompareIn NameLoad AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign AttributeStore AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr Assign AttributeStore AttributeLoad NameLoad attr attr Num Assign AttributeStore AttributeLoad NameLoad attr attr AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad AttributeLoad NameLoad attr attr Assert CompareEq Call NameLoad AttributeLoad NameLoad attr Num Assert CompareIn NameLoad AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign AttributeStore AttributeLoad NameLoad attr attr AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr Assert CompareEq Call NameLoad AttributeLoad NameLoad attr Num Assert CompareIn NameLoad AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assert CompareEq Call NameLoad NameLoad Num Assert Call NameLoad ListComp CompareIn NameLoad TupleLoad Num Num comprehension NameStore NameLoad CompareIn NameLoad TupleLoad Num Num decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore AttributeLoad AttributeLoad NameLoad attr attr Assert CompareEq Call NameLoad NameLoad NameLoad Assert Call NameLoad SubscriptLoad NameLoad Index Num Call NameLoad Call AttributeLoad NameLoad attr ListLoad Num Assert CompareEq Call NameLoad ListComp AttributeLoad NameLoad attr comprehension NameStore NameLoad Num decorator_list FunctionDef arguments args NameParam defaults body Assign AttributeStore AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore AttributeLoad AttributeLoad NameLoad attr attr Assert CompareGt Call NameLoad ListComp AttributeLoad NameLoad attr comprehension NameStore NameLoad Num decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad NameLoad attr keyword Call NameLoad Str keyword NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore AttributeLoad AttributeLoad NameLoad attr attr Assert CompareEq AttributeLoad SubscriptLoad NameLoad Index Num attr AttributeLoad SubscriptLoad NameLoad Index Num attr Assert CompareEq AttributeLoad SubscriptLoad NameLoad Index Num attr AttributeLoad SubscriptLoad NameLoad Index Num attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore AttributeLoad AttributeLoad NameLoad attr attr Assert CompareEq Call NameLoad NameLoad NameLoad Assert Call NameLoad SubscriptLoad NameLoad Index Num Call NameLoad Call AttributeLoad NameLoad attr ListLoad Num decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore AttributeLoad AttributeLoad NameLoad attr attr Assert CompareEq Call NameLoad NameLoad NameLoad Assert Call NameLoad SubscriptLoad NameLoad Index Num Call NameLoad Call AttributeLoad NameLoad attr ListLoad Num decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore AttributeLoad AttributeLoad NameLoad attr attr Assert CompareEq Call NameLoad NameLoad NameLoad Assert Call NameLoad SubscriptLoad NameLoad Index Num Call NameLoad Call AttributeLoad NameLoad attr ListLoad Num decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Assert CompareEq Call NameLoad NameLoad AttributeLoad AttributeLoad NameLoad attr attr Assert Call NameLoad SubscriptLoad NameLoad Index Num Call NameLoad Call AttributeLoad NameLoad attr ListLoad Num Assert Call NameLoad Call NameLoad NameLoad Call NameLoad TupleLoad Num ListLoad Num Num Num Num Num Assert CompareEq Call NameLoad Call NameLoad NameLoad Num Assert CompareEq Call NameLoad SubscriptLoad Call NameLoad NameLoad Index Num Num decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Assign TupleStore NameStore NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Assert CompareEq NameLoad AttributeLoad SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index Num attr Assert CompareEq NameLoad AttributeLoad SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index Num attr decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Assert Call NameLoad Call NameLoad NameLoad Call NameLoad TupleLoad Num ListLoad Num Num Num Num Num Assert CompareEq Call NameLoad Call NameLoad NameLoad Num Assert CompareEq Call NameLoad SubscriptLoad Call NameLoad NameLoad Index Num Num decorator_list FunctionDef arguments args NameParam defaults body Pass decorator_list decorator_list If CompareEq NameLoad Str body Expr Call AttributeLoad NameLoad attr
N/A N/A 
test_pyeasyga
----------------------------------

Tests for `pyeasyga` module.
 N/A unittest N/A copy operator attrgetter six next pyeasyga pyeasyga TestPyeasyga N/A N/A unittest TestCase N/A setUp N/A N/A self N/A N/A N/A Test Problem: Assume you can only carry 3 items to sell in your bag.
        Pick a combination of items that maximises your profit. The profit for
        each item is listed.
         N/A N/A self seed_data N/A N/A apple 15 N/A banana 10 N/A carrot 12 N/A pear 5 N/A mango 8 N/A member_1 N/A N/A pyeasyga Chromosome N/A 0 1 0 1 1 N/A member_2 N/A N/A pyeasyga Chromosome N/A 1 1 0 0 1 N/A member_3 N/A N/A pyeasyga Chromosome N/A 1 1 1 1 0 N/A member_4 N/A N/A pyeasyga Chromosome N/A 0 1 1 1 1 N/A N/A self population N/A N/A N/A N/A N/A self population append member_1 N/A N/A N/A N/A self population append member_2 N/A N/A N/A N/A self population append member_3 N/A N/A N/A N/A self population append member_4 N/A N/A self ga N/A N/A pyeasyga GeneticAlgorithm N/A self seed_data N/A N/A N/A self ga population_size 10 N/A N/A N/A self ga generations 10 N/A N/A N/A self ga fitness_function N/A N/A N/A member data N/A N/A sum N/A profit N/A N/A selected N/A fruit profit N/A zip member data N/A selected N/A N/A N/A member count 1 3 N/A N/A N/A self ga selection_function N/A N/A self ga tournament_selection N/A test_genetic_algorithm_initialisation_1 N/A N/A self N/A N/A N/A  Test default initialisation  N/A ga_1 N/A N/A pyeasyga GeneticAlgorithm N/A self seed_data N/A N/A N/A ga_1 population_size 50 N/A N/A N/A ga_1 generations 100 N/A N/A N/A ga_1 elitism True N/A N/A N/A ga_1 crossover_probability 0.8 N/A N/A N/A ga_1 mutation_probability 0.2 N/A test_genetic_algorithm_initialisation_2 N/A N/A self N/A N/A N/A  Test initialisation with specific values  N/A ga_2 N/A N/A pyeasyga GeneticAlgorithm N/A self seed_data population_size 235 generations 57 crossover_probability 0.9 mutation_probability 0.05 N/A N/A ga_2 elitism False N/A N/A ga_2 maximise_fitness False N/A N/A fruit profit N/A N/A ga_2 seed_data N/A 1 N/A N/A N/A len N/A ga_2 seed_data 5 N/A N/A N/A fruit profit N/A banana 10 N/A N/A N/A ga_2 population_size 235 N/A N/A N/A ga_2 generations 57 N/A N/A N/A ga_2 elitism False N/A N/A N/A ga_2 maximise_fitness False N/A N/A N/A ga_2 crossover_probability 0.9 N/A N/A N/A ga_2 mutation_probability 0.05 N/A test_chromosome_initialisation_1 N/A N/A self N/A N/A N/A chromosome N/A N/A pyeasyga Chromosome N/A a b c N/A N/A N/A chromosome genes N/A a b c N/A N/A N/A chromosome fitness 0 N/A N/A N/A str chromosome (0, ['a', 'b', 'c']) N/A test_chromosome_initialisation_2 N/A N/A self N/A N/A N/A chromosome N/A N/A pyeasyga Chromosome N/A d e f N/A N/A chromosome fitness 20 N/A N/A N/A chromosome genes N/A d e f N/A N/A N/A chromosome fitness 20 N/A N/A N/A str chromosome (20, ['d', 'e', 'f']) N/A test_fitness_function N/A N/A self N/A N/A N/A func N/A N/A self ga fitness_function N/A data N/A N/A self ga seed_data N/A N/A N/A func N/A 0 1 0 1 1 data 23 N/A N/A N/A func N/A 1 1 0 0 1 data 33 N/A N/A N/A func N/A 1 1 1 1 0 data 0 N/A N/A N/A func N/A 0 1 1 1 1 data 0 N/A test_crossover_function N/A N/A self N/A N/A N/A parent_1 N/A 1 1 1 1 1 N/A parent_2 N/A 0 0 0 0 0 N/A crossover N/A N/A N/A x y N/A N/A N/A N/A x N/A 2 N/A y N/A 2 N/A N/A y N/A 2 N/A x N/A 2 N/A N/A N/A self ga crossover_function crossover N/A N/A child_1 child_2 N/A N/A N/A self ga crossover_function parent_1 parent_2 N/A N/A child_1 N/A 1 1 0 0 0 N/A N/A child_2 N/A 0 0 1 1 1 N/A test_mutate_function N/A N/A self N/A N/A N/A  Check that the individual is not the same after mutation
            Check that only one bit in the individual is changed  N/A individual N/A 0 1 1 0 1 N/A N/A N/A N/A self ga mutate_function individual N/A res N/A N/A x y N/A N/A x y N/A zip individual N/A 0 1 1 0 1 N/A N/A individual N/A 0 1 1 0 1 N/A N/A N/A N/A res count False 1 N/A test_selection_function_1 N/A N/A self N/A N/A N/A  Test tournament selection  N/A N/A N/A self ga current_generation N/A self population N/A N/A N/A N/A self ga calculate_population_fitness N/A N/A N/A self ga tournament_size 4 N/A N/A N/A self ga selection_function N/A N/A self ga tournament_selection N/A individual N/A N/A N/A self ga selection_function N/A N/A self ga current_generation N/A N/A N/A individual genes N/A 1 1 0 0 1 N/A N/A N/A individual fitness 33 N/A N/A N/A len N/A individual genes 5 N/A N/A individual N/A self population N/A test_selection_function_2 N/A N/A self N/A N/A N/A  Test tournament selection with tournament size 0 N/A N/A N/A self ga current_generation N/A self population N/A N/A N/A N/A self ga calculate_population_fitness N/A N/A N/A self ga tournament_size 0 N/A N/A N/A self ga selection_function N/A N/A self ga tournament_selection N/A individual N/A N/A N/A self ga selection_function N/A N/A self ga current_generation N/A N/A N/A len N/A individual genes 5 N/A N/A individual N/A self population N/A test_selection_function_3 N/A N/A self N/A N/A N/A  Test random selection  N/A N/A N/A self ga selection_function N/A N/A self ga random_selection N/A individual N/A N/A N/A self ga selection_function N/A self population N/A N/A N/A len N/A individual genes 5 N/A N/A individual N/A self population N/A test_create_individual N/A N/A self N/A N/A N/A data N/A N/A self ga seed_data N/A individual N/A N/A N/A self ga create_individual data N/A N/A N/A len individual 5 N/A N/A all N/A N/A ind N/A 0 1 N/A ind individual N/A ind N/A 0 1 N/A test_create_initial_population N/A N/A self N/A N/A N/A pop_size N/A N/A self ga population_size N/A N/A N/A N/A self ga create_initial_population N/A initial_pop N/A N/A self ga current_generation N/A N/A N/A len initial_pop pop_size N/A N/A isinstance N/A initial_pop N/A 0 N/A type N/A N/A pyeasyga Chromosome N/A 1 N/A N/A N/A sum N/A N/A member fitness N/A member initial_pop 0 N/A test_calculate_population_fitness N/A N/A self N/A N/A N/A N/A N/A self ga current_generation N/A self population N/A N/A N/A N/A self ga calculate_population_fitness N/A current_gen N/A N/A self ga current_generation N/A N/A N/A sum N/A N/A member fitness N/A member current_gen 0 N/A test_rank_population N/A N/A self N/A N/A N/A N/A N/A N/A self ga create_initial_population N/A N/A N/A N/A self ga calculate_population_fitness N/A new_population N/A N/A copy deepcopy N/A N/A self ga current_generation N/A N/A N/A new_population sort key N/A attrgetter fitness reverse True N/A N/A N/A N/A self ga rank_population N/A current_gen N/A N/A self ga current_generation N/A N/A N/A N/A current_gen N/A 0 fitness N/A N/A new_population N/A 0 fitness N/A N/A N/A N/A current_gen N/A 1 fitness N/A N/A new_population N/A 1 fitness N/A test_create_new_population N/A N/A self N/A N/A N/A  Write more functional test  N/A pop_size N/A N/A self ga population_size N/A N/A N/A N/A self ga create_initial_population N/A N/A N/A N/A self ga calculate_population_fitness N/A N/A N/A N/A self ga rank_population N/A N/A N/A N/A self ga create_new_population N/A current_gen N/A N/A self ga current_generation N/A N/A N/A len current_gen pop_size N/A N/A isinstance N/A current_gen N/A 0 N/A type N/A N/A pyeasyga Chromosome N/A 1 N/A test_create_first_generation N/A N/A self N/A N/A N/A  Write more functional test  N/A pop_size N/A N/A self ga population_size N/A N/A N/A N/A self ga create_first_generation N/A current_gen N/A N/A self ga current_generation N/A N/A N/A len current_gen pop_size N/A N/A isinstance N/A current_gen N/A 0 N/A type N/A N/A pyeasyga Chromosome N/A 1 N/A test_create_next_generation N/A N/A self N/A N/A N/A pop_size N/A N/A self ga population_size N/A N/A N/A N/A self ga create_first_generation N/A N/A N/A N/A self ga create_next_generation N/A current_gen N/A N/A self ga current_generation N/A N/A N/A len current_gen pop_size N/A N/A isinstance N/A current_gen N/A 0 N/A type N/A N/A pyeasyga Chromosome N/A 1 N/A test_run N/A N/A self N/A N/A N/A N/A N/A N/A self ga run N/A current_gen N/A N/A self ga current_generation N/A last_generation N/A N/A N/A self ga last_generation N/A N/A N/A len current_gen N/A N/A self ga population_size N/A N/A isinstance N/A current_gen N/A 0 N/A type N/A N/A pyeasyga Chromosome N/A 1 N/A N/A isinstance N/A next last_generation N/A type N/A 1 N/A 1 1 1 1 1 N/A N/A N/A len N/A next last_generation 2 N/A N/A N/A len N/A N/A next last_generation N/A 1 5 N/A test_best_individual N/A N/A self N/A N/A N/A N/A N/A N/A self ga create_first_generation N/A N/A best_fitness best_genes N/A N/A N/A self ga best_individual N/A N/A best_fitness N/A N/A N/A N/A self ga current_generation N/A 0 fitness N/A N/A best_genes N/A N/A N/A N/A self ga current_generation N/A 0 genes N/A test_last_generation N/A N/A self N/A N/A N/A N/A N/A N/A self ga create_first_generation N/A last_generation N/A N/A N/A self ga last_generation N/A N/A isinstance N/A next last_generation N/A type N/A 1 N/A 1 1 1 1 1 N/A N/A N/A len N/A next last_generation 2 N/A N/A N/A len N/A N/A next last_generation N/A 1 5 N/A tearDown N/A N/A self N/A N/A N/A N/A N/A N/A N/A __name__ __main__ N/A N/A N/A N/A unittest main