hiddenUnits = 4 batch=1 #number of samples per learning step prnts=1 #number of learning steps after results are printed epis=10000/batch/prnts #number of roleouts numbExp=10 #number of experiments et = ExTools(batch, prnts) #tool for printing and plotting env = None for runs in range(numbExp): # create environment #Options: XML-Model, Bool(OpenGL), Bool(Realtime simu. while client is connected), ServerIP(default:localhost), Port(default:21560) if env != None: env.closeSocket() env = CCRLEnvironment() # create task task = CCRLGlasTask(env) # create controller network net = buildNetwork(len(task.getObservation()), hiddenUnits, env.actLen, outclass=TanhLayer) # create agent with controller and learner (and its options) agent = OptimizationAgent(net, PGPE(storeAllEvaluations = True)) et.agent = agent # create the experiment experiment = EpisodicExperiment(task, agent) #Do the experiment for updates in range(epis): for i in range(prnts): experiment.doEpisodes(batch) et.printResults((agent.learner._allEvaluations)[-50:-1], runs, updates) et.addExps() et.showExps()
__author__ = 'Stubborn' from pybrain.rl.environments.ode import CCRLEnvironment from pybrain.rl.environments.ode.tasks import CCRLGlasTask from pybrain.tools.shortcuts import buildNetwork from pybrain.structure.modules.tanhlayer import TanhLayer from pybrain.optimization import PGPE from pybrain.rl.agents import OptimizationAgent from pybrain.rl.experiments import EpisodicExperiment environment = CCRLEnvironment() task = CCRLGlasTask(environment) net = buildNetwork(len(task.getObservation()), 4, environment.indim, outclass=TanhLayer) agent = OptimizationAgent(net, PGPE()) experiment = EpisodicExperiment(task, agent) for updates in range(20000): experiment.doEpisodes(1)
hiddenUnits = 4 batch = 1 #number of samples per learning step prnts = 1 #number of learning steps after results are printed epis = 2000 / batch / prnts #number of roleouts numbExp = 10 #number of experiments et = ExTools(batch, prnts) #tool for printing and plotting env = None for runs in range(numbExp): # create environment #Options: XML-Model, Bool(OpenGL), Bool(Realtime simu. while client is connected), ServerIP(default:localhost), Port(default:21560) if env != None: env.closeSocket() env = CCRLEnvironment() # create task task = CCRLGlasTask(env) # create controller network net = buildNetwork(len(task.getObservation()), hiddenUnits, env.actLen, outclass=TanhLayer) #, hiddenUnits # create agent with controller and learner (and its options) agent = OptimizationAgent(net, PGPE(storeAllEvaluations=True)) et.agent = agent # create the experiment experiment = EpisodicExperiment(task, agent) #Do the experiment for updates in range(epis): for i in range(prnts): experiment.doEpisodes(batch)