jmenashe / rl-glue-ext

Automatically exported from code.google.com/p/rl-glue-ext
0 stars 0 forks source link

Loading agents with Java RL-Glue #6

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
http://code.google.com/p/rl-glue/issues/detail?id=54

Original issue reported on code.google.com by brian.ta...@gmail.com on 2 Sep 2008 at 10:12

GoogleCodeExporter commented 8 years ago
The Java Examples were broken on OS X, for a few reasons.

This all stems from the makefiles having a few inconsistencies, in:

Examples/basic_examples/Java/{Agent/Environment/Experiment}

First, the platform was being determined with uname -o.  This option
doesn't appear to exist on OS X.  I think maybe uname -s is a better option?

Second, there were multiple CLASSPATH variables that were being used for
building with JAVAC and for creating the run script on the fly.  I think
they were working on Windows but not on Mac.

Third, echo -e is used to create the run scripts on the fly, but echo -e
doesn't exist on Mac (-e is supposed to correctly understand escaped
characters like \n).  On Mac, this just works without any extra parameter.

We also have a new way of loading agents and envs with RL-Glue, something a
little cuter.

Instead of:
java -Xmx128M -classpath ./Build:../../../../RL-Glue/Java/RL-Glue.jar
rlglue.agent.AgentLoader RandomAgent.RandomAgent

It is now:
java -Xmx128M -classpath ./Build:../../../../RL-Glue/Java/RL-Glue.jar
rlglue.RLGlueCore --agent RandomAgent.RandomAgent

I like this better, because you can also do:
rlglue.RLGlueCore --environment SomeEnvironment.SomeEnvironment 

or

rlGlue.RLGlueCore --version
(which will print out the version of RL-Glue as defined in it's new Manifest).

It might just be a matter of taste, but I think this comes across more
professional.  The old way still works.

I've updated Agent/makefile to solve these problems and to use the new
loading mechanism.  Someone needs to test it on Windows and Linux please. 
Then, make the same style of changes to the other java makefiles please.

Original comment by brian.ta...@gmail.com on 18 Sep 2008 at 1:48

GoogleCodeExporter commented 8 years ago
I'm not even sure that I like that way anymore.  we can keep it, but there are 
better
options.  How about people just make their agents self-loadable.  
Like this (this is how all of the test agents/envs/exps work):
    //This is inside Test_1_Agent.java
    public static void main(String[] args){
        AgentLoader L=new AgentLoader(new Test_1_Agent());
        L.run();
    }

We just need to document this somewhere as the recommended approach.

Original comment by brian.ta...@gmail.com on 18 Sep 2008 at 1:49

GoogleCodeExporter commented 8 years ago
This has been documented in the manual.  Closing.

Original comment by brian.ta...@gmail.com on 1 Oct 2008 at 6:41