예제 #1
0
def make_generation(seeds, num_children):
    #print seeds
    pop = [None] * len(seeds) * (num_children + 1)
    i = 0
    for seed in seeds:
        #print seed
        pop[i] = seed
        i += 1
        for n in xrange(num_children):
            #print seed
            #run one mutation, TODO: variable number of mutations based on size
            #print 'Seed: ',seed
            bot = mutate(copy.deepcopy(seed))
            #print bot, bot != []
            if bot != []:
                pop[i] = bot
            else:
                #print "creating new bot"
                pop[i] = bot_maker.create_bot(genome_stop_probability=0.2)
            i += 1
    return pop
예제 #2
0
def make_generation(seeds, num_children):
    #print seeds
    pop = [None]*len(seeds)*(num_children+1)
    i = 0
    for seed in seeds:
        #print seed
        pop[i] = seed
        i += 1
        for n in xrange(num_children):
            #print seed
            #run one mutation, TODO: variable number of mutations based on size
            #print 'Seed: ',seed
            bot = mutate(copy.deepcopy(seed))
            #print bot, bot != []
            if bot != []:
                pop[i] = bot
            else:
                #print "creating new bot"
                pop[i] = bot_maker.create_bot(genome_stop_probability=0.2)
            i += 1
    return pop
예제 #3
0
def initialize_population(pop_size):
    pop = [None] * pop_size
    for i in xrange(pop_size):
        pop[i] = bot_maker.create_bot(genome_stop_probability=0.1)
    return pop
예제 #4
0
def initialize_population(pop_size):
    pop = [None]*pop_size
    for i in xrange(pop_size):
        pop[i] = bot_maker.create_bot(genome_stop_probability=0.2)
    return pop