コード例 #1
0
 def learn_genomeIRL(self): #input the reward function
   pool = Pool.spawn(Genome.open('policies/generic.net'), 20)
   # Set evolutionary parameters
   eonnIRL.keep = 15 ; eonnIRL.mutate_prob = 0.4 ; eonnIRL.mutate_frac = 0.1;eonnIRL.mutate_std = 0.8;eonnIRL.mutate_repl = 0.15
   # Evolve population
   pool = eonnIRL.optimize(pool, self.percieved_eval,400) # These are imported functions from EONNIRL
   champion = max(pool)
   # Print results
   print '\nerror:', math.exp(1 / self.percieved_eval(champion.policy))
   #print '\ngenome:\n%s' % champion.genome
   return champion.policy
コード例 #2
0
 def learnGenomeIRL(theta):  #input the reward function
     pool = Pool.spawn(Genome.open('policies/generic.net'), 20)
     # Set evolutionary parameters
     eonnIRL.keep = 15
     eonnIRL.mutate_prob = 0.4
     eonnIRL.mutate_frac = 0.1
     eonnIRL.mutate_std = 0.8
     eonnIRL.mutate_repl = 0.15
     # Evolve population
     pool = eonnIRL.optimize(pool, hoverIRL, theta)
     champion = max(pool)
     # Print results
     print '\nerror:', math.exp(1 / hover(champion.policy))
     print '\nerror:', math.exp(1 / hoverIRL(champion.policy, theta))
     print '\ngenome:\n%s' % champion.genome
コード例 #3
0
 def learnGenomeIRL(theta): #input the reward function
   pool = Pool.spawn(Genome.open('policies/generic.net'), 20)
   # Set evolutionary parameters
   eonnIRL.keep = 15
   eonnIRL.mutate_prob = 0.4
   eonnIRL.mutate_frac = 0.1
   eonnIRL.mutate_std = 0.8
   eonnIRL.mutate_repl = 0.15
   # Evolve population
   pool = eonnIRL.optimize(pool, hoverIRL,theta)
   champion = max(pool)
   # Print results
   print '\nerror:', math.exp(1 / hover(champion.policy))
   print '\nerror:', math.exp(1 / hoverIRL(champion.policy,theta))
   print '\ngenome:\n%s' % champion.genome