Open GoogleCodeExporter opened 8 years ago
Brian,
just in case it might help. The way I am doing this in python (launching
experiment,
environment and agent from within a single script) is the following (please
bare with
me this is a sample script, and many parts are missing, but you get the idea).
You
need to invoke the python interpreter three times though (it doesn't launch
everything at once; I leave that as another exercise I haven't done yet).
class MySampleAgent(): pass
class MySampleExperiment(): pass
class MySampleEnvironment(): pass
def start_agent(agent):
AgentLoader.loadAgent(agent)
def start_environment(environment):
EnvironmentLoader.loadEnvironment(environment)
def start_experiment(experiment):
experiment.init()
experiment.start()
experiment.run()
experiment.cleanup()
if __name__=="__main__":
import sys
def usage():
print "%s [agent|environment|experiment]" % sys.argv[0]
if len(sys.argv) < 2:
usage()
exit(0)
role = sys.argv[1]
if role == 'agent':
start_agent(MySampleAgent())
elif role == 'environment':
start_environment(MySampleEnvironment())
elif role == 'experiment':
start_experiment(MySampleExperiment())
else:
usage()
exit(0)
Original comment by ricardok...@gmail.com
on 21 May 2009 at 2:36
Original issue reported on code.google.com by
brian.ta...@gmail.com
on 7 Feb 2009 at 11:18