Ejemplo n.º 1
0
 def evolve_policy(self):
     """ Learn a model from flightdata and evolve specialized policies. """
     params = model.estimate_params(self.log.name)
     noise_std = model.estimate_std(self.log.name, params)
     heli = ghh.Helicopter(params, noise_std, 0.1)
     genome = Genome.open(PREFIX + 'baseline.net')
     self.org = functions.evolve(heli, genome, epochs=500)
Ejemplo n.º 2
0
 def evolve_policy(self, n=1):
   """ Learn a model from flightdata and evolve specialized policies. """
   params = model.estimate_params(self.log.name)
   noise_std = model.estimate_std(self.log.name, params)
   heli = ghh.Helicopter(params, noise_std, 0.1)
   genome = Genome.open(PREFIX + 'baseline.net')
   for i in range(n):
     champion = functions.evolve(heli, genome, epochs=500)
     champion.evals = list()
     self.pool.append(champion)
Ejemplo n.º 3
0
 def evolve_policy(self, n=1):
     """ Learn a model from flightdata and evolve specialized policies. """
     params = model.estimate_params(self.log.name)
     noise_std = model.estimate_std(self.log.name, params)
     heli = ghh.Helicopter(params, noise_std, 0.1)
     genome = Genome.open(PREFIX + 'baseline.net')
     for i in range(n):
         champion = functions.evolve(heli, genome, epochs=500)
         champion.evals = list()
         self.pool.append(champion)
Ejemplo n.º 4
0
# rk4.py 4th order Runge Kutta

from pylab import *
from functions import evolve, H

pltparams = {'text.usetex': True}
rcParams.update(pltparams)

a = 0.  # evolve from time a to time b in n steps
b = 100.
n = 10000
times, h = linspace(a, b, n, retstep=True)

# find the position and velocities as functions of time and the times when v=0 for initial position equal to 1
x1_t, v1_t, t1_0 = evolve([1, 0], times, h)

# find the position and velocities as functions of time and the times when v=0 for initial position equal to 2
x2_t, v2_t, t2_0 = evolve([2, 0], times, h)

#plot the position and energy of the harmonic oscillator
figure("position and energy")
subplot(211)
ylabel("$x(t)$")
plot(times, x1_t)
plot(times, cos(times), "--")
subplot(212)
ylabel("$E(t)$")
xlabel("Times (a.u.)")
plot(times, H(x1_t, v1_t))
plot(times, 1 / 2 * ones_like(times))
Ejemplo n.º 5
0
pltparams = {
    'text.usetex': True
}
rcParams.update(pltparams)

a = 0.     # evolve from time a to time b in n steps
b = 100.
n = 10000
times, h = linspace(a, b, n, retstep=True)

y_0 = [1,0]   #initialize position and velocity
x_t = [y_0[0], ]
v_t = [y_0[1], ]

# find the position and velocities as functions of time and the times when v=0
x1_t, v1_t, t1_0 = evolve(y_0, times, h)


#plot position and energy of the harmonic oscillator
figure("position and energy")
subplot(211)
ylabel("$x(t)$")
plot(times, x_t)
plot(times, cos(times), "--")
subplot(212)
ylabel("$E(t)$")
xlabel("Times (a.u.)")
plot(times, H(x_t, v_t))
plot(times, 1/2*ones_like(times))
show()