def evolve_policy(self): """ Evolve a specialized policy using learned model. """ pool = spawn(Genome.open(PREFIX + 'model.net'), 50) feval = functions.Evaluator(self.model) self.org = max(eonn.optimize(pool, feval.call, 2500, verbose=False)) self.org.evals = [] self.pool.append(self.org)
def evolve_policy(self): """ Evolve a specialized policy using learned model. """ pool = spawn(Genome.open(PREFIX + "model.net"), 50) feval = functions.Evaluator(self.model) self.org = max(eonn.optimize(pool, feval.call, 2500, verbose=False)) self.org.evals = [] self.pool.append(self.org)
def main(): output = open("log_%s.txt" % "".join(random.sample(letters + digits, 10)), "w") pool = organism.spawn(Genome.open(PROTOTYPE), 30) for i in range(25): pool, champion = optimize(pool, race_resampling, hover, 20000) output.write("%i %.3f\n" % ((i + 1) * 20000, champion.fitness)) output.flush() output.close()
def main(): output = open('log_%s.txt' % ''.join(random.sample(letters + digits, 10)), 'w') pool = organism.spawn(Genome.open(PROTOTYPE), 30) for i in range(25): pool, champion = optimize(pool, race_resampling, hover, 20000) output.write('%i %.3f\n' % ((i + 1) * 20000, champion.fitness)) output.flush() output.close()
def evolve(heli, genome, popsize=50, epochs=100, keep=49, mutate_prob=.75, mutate_frac=.1, mutate_std=.8, mutate_repl=.25, verbose=False): """ Evolve a specialized policy for the given helicopter environment. """ # Set evolutionary parameters eonn.keep = keep eonn.mutate_prob = mutate_prob eonn.mutate_frac = mutate_frac eonn.mutate_std = mutate_std eonn.mutate_repl = mutate_repl # Evolve population and return champion feval = Evaluator(heli) pool = spawn(genome, popsize) return max(eonn.optimize(pool, feval.call, epochs, 1, verbose))