Exemple #1
0
 def _notify(self):
     HillClimber._notify(self)
     if self.verbose:
         print '  Bits on in best mask:', sum(self.bestEvaluable.mask)
Exemple #2
0
 def _learnStep(self):
     self.switchMutations()
     HillClimber._learnStep(self)
     self.switchMutations()
Exemple #3
0
 def _learnStep(self):
     self.switchMutations()
     HillClimber._learnStep(self)
     self.switchMutations()
Exemple #4
0
 def _notify(self):
     HillClimber._notify(self)
     if self.verbose:
         print '  Bits on in best mask:', sum(self.bestEvaluable.mask)
# coding=utf-8
from pybrain.optimization.hillclimber import HillClimber
from pybrain.rl.agents.optimization import OptimizationAgent

from pybrain.rl.environments.cartpole.balancetask import BalanceTask
from pybrain.rl.experiments.episodic import EpisodicExperiment
from pybrain.tools.shortcuts import buildNetwork


task = BalanceTask()

net = buildNetwork(task.outdim, 3, task.indim)

agent = OptimizationAgent(net, HillClimber())
exp = EpisodicExperiment(task, agent)
exp.doEpisodes(100)

print(exp)