genetic-programming

overlapping in matplotlib plot

overlapping in matplotlib plot Question: I am comparing the execution time of an exhaustive search and genetic algorithm along with sample solutions. In the graph below, I am trying to improve the readability of my graph. However, they overlap with each other. Sample Code: import matplotlib.pyplot as plt # define the data exhaustive_search = [72, …

Total answers: 1

Iterating a list: getting values as[set(), set(), set(), set(), set()]

Iterating a list: getting values as[set(), set(), set(), set(), set()] Question: I have a list (df_pop_initial_list), and it looks like this: [[‘000000000000000000000000000001011000000’], [‘000000001000000000000001000000000010000’], [‘000000000000000000000000000000010011000’], [‘000000000000001001000000000000010000000’], [‘000000000000000000010000001000000010000’], [‘1000000000100000000010000000000000000000’], [‘1000000010000000000001000000000000000000’], [‘1001000000000000000010000000000000000000’], [‘000000000000100000000000100000000000010’], [‘000000000110000000000000000000001000000’], [‘000000101000000010000000000000000000000’], [‘000000000000001000000010000100000000000’], [‘000000000000000010000101000000000000000’], [‘000000001000100000000000000000000100000’], [‘000000100000000000000000010000001000000’], [‘000000000000001100000000000010000000000’], [‘010000000000000000000000000001001000000’], [‘000000010100000001000000000000000000000’], [‘000000000000000000001000000001100000000’], [‘000100000000000100000000000000000000010′]] I am trying to count 1’s in this 39 bits string list and converting …

Total answers: 1

finding indexes of 1's in a bit string and storing these indexes in a list — Index should be started from 1 not 0

finding indexes of 1's in a bit string and storing these indexes in a list — Index should be started from 1 not 0 Question: I am finding indexes of 1’s in a bit string successfully. However, these indexes start from 0. Sample Data: initial_pop 000000000000000000000000000001011000000 000000001000000000000001000000000010000 000000000000000000000000000000010011000 000000000000001001000000000000010000000 000000000000000000010000001000000010000 1000000000100000000010000000000000000000 1000000010000000000001000000000000000000 1001000000000000000010000000000000000000 000000000000100000000000100000000000010 000000000110000000000000000000001000000 …

Total answers: 2

counting 1's in a bit string to keep positions in a variable and then accessing each value

counting 1's in a bit string to keep positions in a variable and then accessing each value Question: I am finding 1’s in a bit string and then storing them. Sample Data: Sample code: def indices(chromosome): return {i for i,c in enumerate(chromosome) if c==’1′} for ind in df_initial_pop[‘initial_pop’].index: locations = indices(df_initial_pop[‘initial_pop’] [ind]) print (locations) Output: …

Total answers: 1

Cross-over is failing binary encoded string

Cross-over is failing binary encoded string Question: I am implementing Genetic Algorithm (GA). There are 43 numbers [Ambulance Locations] to choose from (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, …

Total answers: 1