Installing RL-Glue and ALE without Root Access

In 2012 Bellemare, Naddaf, Veness, and Bowling [1] introduced the Arcade Learning Environment (ALE) for developing and evaluating general AI methods. It interfaces with an Atari 2600 simulator called Stella. They motivate their use of the the Atari 2600 because it permits access to hundreds of "game environments, each one different, interesting, and designed to be a challenge for human players." ALE also interfaces with RL-Glue, a collection of tools for developing and evaluating Reinforcement Learning agents.

RL-Glue is a two part system; a language agnostic part, referred to as the core, and a language specific part, referred to as the codec. There are multiple codecs supporting development in C/C++, Java, Lisp, Matlab, and Python.

The following discusses installing RL-Glue and ALE. First I cover installing RL-Glue and then ALE.

Installing RL-Glue

The instructions for installing the RL-Glue core and Python codec are drawn from the technical manuals for versions 3.04 and 2.0 and assume versions 3.04 and 2.02 respectively. However, looking over older versions of the manual it appears these instructions have not changed much, if at all, which means they may also work for future versions with the correct changes in the commands. I leave it as an exercise to the reader to determine what changes are needed. (Don't you love it when an author does that?)

Installing RL-Glue in the user space as opposed to system wide requires compiling the core code from source. To do so, execute the following commands.

RL-Glue Core

1. Download RL-Glue Core
$ cd ~ && wget http://rl-glue-ext.googlecode.com/files/rlglue-3.04.tar.gz
2. Unpack RL-Glue Core
$ tar -xvzf rlglue-3.04.tar.gz
3. Make a directory into which RL-Glue will be installed:
$ mkdir ~/rlglue
4. Configure RL-Glue Core
At this point it is necessary to identify the location wherein you wish to install the core as you must tell this to the configure script. I made a directory called rlglue in my home directory resulting in the following command:
$ cd rlglue-3.04 && ./configure --prefix=<rlglue>
where <rlglue> is the absolute path to the directory into which you want RL-glue installed.
5. Build and install RL-Glue Core
$ make && make install
6. Update your PATH
Because the core has been installed in a non-standard location it is necessary to inform the system of it's location. This merely entails updating your PATH environment variable to include rlglue/bin, i.e.:
$ export PATH=~/rlglue/bin:$PATH
Note that you can make this change in your .bashrc to avoid doing it every time you open a new terminal.

At this point executing rl_glue should result in:
RL-Glue Version 3.04, Build 909
RL-Glue is listening for connections on port=4096
This indicates that RL-Glue is waiting for programs managing the agent, environment, and experiment to connect. For now you can type ctrl-c to exit the program.

Python Codec

1. Download the Python Codec
$ cd ~ && wget http://rl-glue-ext.googlecode.com/files/python-codec-2.02.tar.gz
2. Unpack the codec
$ tar -xvzf python-codec-2.02.tar.gz
3. Update your PYTHONPATH
This is another step that is only necessary because we're installing into a non-standard location.
$ export PYTHONPATH=~/python-codec/src
Note that this is another command that can be placed into your .bashrc to avoid executing it every time you open a new terminal.

Installing ALE

Installing ALE takes a little more effort. This is due to the fact that ALE does not supply a configure script to build a makefile specific for your system. These instruction are for installing ALE 0.4.3 and may not extend to newer versions well so your mileage may vary. As before, execute the following commands.

1. Download ALE
$ wget http://www.arcadelearningenvironment.org/wp-content/uploads/2014/01/ale_0.4.3.zip
2. Unpack ALE
$ unzip ale_0.4.3.zip
3. Select Makefile
ALE supports Linux, OSX, and Windows and as such a makefile is supplied for each platform. Installing ALE requires making a makefile from one of these. I advise copying the one you want as opposed to renaming it:
$ cd ale_0.4.3/ale_0_4/ && cp makefile.unix makefile
Update 2014-04-15: Frédéric Bastien notes that this step can be avoided by supplying the name of the preferred makefile to make on the command line as follows:
$ make -f makefile.unix
Still be sure to change your working directory to ale_0.4.3/ale_0_4 as the following commands assume that context.

4. Enable RL-Glue support
RL-Glue support in ALE is disabled by default. To enable it edit the makefile and change the line:
It is also necessary to inform ALE where the RL-Glue headers are located. This can be done by changing the line:
INCLUDES := -Isrc/controllers -Isrc/os_dependent -I/usr/include -Isrc/environment
INCLUDES :=-Isrc/controllers -Isrc/os_dependent -I/usr/include -Isrc/environment -I<rlgluedir>/include
where <rlgluedir> indicates the directory into which rlglue was installed earlier.

Similarly it is necessary to inform ALE where the RL-Glue libraries are installed. This is done by changing the line:
LIBS_RLGLUE := -lrlutils -lrlgluenetdev
LIBS_RLGLUE := -L<rlgluedir>/lib -lrlutils -lrlgluenetdev
Update 2014-04-15: Frédéric Bastien notes that one can override these variables on the command line. For example:
$ make USE_RLGLUE=1
sets USE_RLGLUE to 1. However it is unclear how to append to variables via the command line so this may only work for the USE_RLGLUE variable without restating the existing variable value.

5. Build ALE
$ make
Because the RL-Glue libraries have been installed in a non-standard location it is necessary to tell ALE where to find them. This is done using the LD_LIBRARY_PATH environment variable as follows:
$ export LD_LIBRARY_PATH=<rlgluedir>/lib:$LD_LIBRARY_PATH
Note that this is another command you can add to your .bashrc to avoid needing to execute the command every time you open a new terminal.

7. Update your PATH
As before it is necessary to update your path to inform the system of the location of the ALE binaries since they are installed in a non-standard location.
$ export PATH=~/ale_0.4.3/ale_0_4:$PATH
Note that this is yet another command you will have to execute every time you open a terminal unless you add this command to your .bashrc.

At this point you can execute ale which should result in:
A.L.E: Arcade Learning Environment (version 0.4)
[Powered by Stella]
Use -help for help screen.
Warning: couldn't load settings file: ./stellarc
No ROM File specified or the ROM file was not found.
Disregard the warnings, they are simply saying that ALE was unable to find your stella configuration and that a game ROM was not specified. This is to be expected since you did not specify the locations for them.


This covers installing RL-Glue and ALE. I have not discussed anything beyond basic testing as such material can be found in the documentation for the tools.

In a future post, or possibly more than one, I will outline the processes for making and executing agents, environments, and experiments.


[1] Bellemare, Marc G., et al. "The arcade learning environment: An evaluation platform for general agents." arXiv preprint arXiv:1207.4708 (2012).


What's Wrong with the Turing Test?

If I could answer one question through the course of my research it would be "what is intelligence?" This question like no other drives my studies. I wrote this post a while ago but did not post it. I did not post it because I intended to refine it. But the reality is I will always be refining my thoughts on this topic. Tonight I went out to the pub with several of my colleagues at Université de Montréal and this topic came up reminding me that I need to just put this out there. As such I am posting it now, with some small changes. I look forward to your responses.

The question "what is intelligence?" is non-trivial. We have been seeking an answer for millennia. While many definitions have been offered [1] no single definition has really ever dominated. Even in the sixty or so years that we have been seriously studying how to create an artificial intelligence we have never actually formally defined intelligence. Ask 100 people to define it and you will likely receive 100 different definitions [1], [2]. The de facto standard is the Turing test developed by Alan Turing [3]. History tells us that he was worried about getting mired in a long drawn out philosophical debate which would likely prevent any progress on actually creating an artificially intelligent being.

The Turing Test as it has come to be known is a variation on a game known as the imitation game [2] wherein a participant, the interrogator, attempts to identify which of the other two participants, one male and one female, was in fact male. Of course the female's objective was to fool the interrogator. The crux of the game was that the decision had to be made solely from communication patterns. In other words, the interrogator did not meet nor could they see the other participants. Additionally, to avoid cues from writing styles, messages would be passed between them in an anonymous way, such as through a computer terminal.

In the Turing Test the objective is to identify the artificial being [4], the computer, as opposed to the male. The hypothesis being that if the interrogator cannot differentiate the artificial being and the human, the artificial being must necessarily be intelligent if we accept that humans are intelligent. This test is clever because it does not require a definition of intelligence nor a measure of intelligence other than agreement that humans are intelligent. However the Turing Test is a behavioral test. Not everyone accepts the test. One of the more well known opponents is John Searle, a professor of philosophy at the University of California, Berkeley. Dr. Searle offers the Chinese Room argument in counter to the Turing Test.

According to the Chinese Room argument we can construct a process that appears intelligent but in fact is not. We do so by placing a person in a room, particularly one that does not speak Chinese. The resident will receive messages from outside the room written in Chinese. The resident must then consult a set of instructions that, when followed, dictate the appropriate response. One, that to any outside observer, would have to have been written by someone that knows Chinese. Since the resident does not know Chinese it supposedly follows that intelligence had only been imitated by the process.

There are a number of counter arguments to the Chinese Room argument. Some argue that the analogy breaks down as a result of the fact that a human performing the processing would simply take too long. Others argue that the room itself is intelligent. But I digress.

While I don't personally accept the Chinese Room argument I do agree there is a flaw in the Turing Test. Specifically, by the nature of its construction, it will permit us to classify a being as intelligent if it behaves like a human. From this we have to conclude that everything else is either not intelligent or at least not classifiable as intelligent without some added criterion.

This not only applies to the animals but to all other beings. Consider the scenario wherein we are visited by aliens that can talk to us, that can do incredibly complicated mathematics, even teach us a few things, and possess technologies way beyond our understanding such as a clearly engineered means of interstellar travel which they used to come to Earth. Would we consider these beings intelligent? We can all think of scenarios wherein the answer is "not necessarily" but in all likelihood we would agree that they are in fact intelligent. But how likely is it that the Turing test will apply?

Of course this problem applies to artificial beings as well, i.e. our computer programs. Have we already created an artificial intelligence? Some might argue we have with Cleverbot garnering 59.3% positive votes from 1,334 participants at the Techniche 2011 festival. Others would likely respond that the real turing test involves physical interaction, i.e. shaking hands with the being, and still not being able to discern a difference. This again highlights the problem.

A precise definition of intelligence would address this problem. However it would not only allow us to differentiate between intelligent and not and answer the question of whether we have already created an artificial intelligence. But it could allow for the development of metrics for comparing intelligences and even help us understand why our existing creations are not intelligent, if that is truly the case.

[1] Legg & Hutter, 2006, A Collection of Definitions of Intelligence, http://www.vetta.org/documents/A-Collection-of-Definitions-of-Intelligence.pdf
[2] Pfeifer, 1999, Understanding Intelligence
[3] Turing, 1950, Computing Machinery and Intelligence http://www.csee.umbc.edu/courses/471/papers/turing.pdf
[4] Russel and Norvig, 2009, Artificial Intelligence: A Modern Approach Third Edition