#10 Arm Bandit Jeshuran Thangaraj
SimpleExp.cxx: This contains the file that implements the experiments. Average , and constant step size
Plots: Contains plot for both experiments.
Documentation for RlGlue is given below: Created by: Matthew Schlegel, Created on: Jan 3, 2017
This will be a general overview of the framework used for this course. It is a simpler version of the RLGlue found at http://glue.rl-community.org/wiki/Main_Page. Please use this for ALL assignment code unless otherwise specified in the assignment or in class. If there are any questions contact Adam White or Matthew Schlegel.
You should only use gsl as your linear algebra pack, no other LA libraries will be used during grading.
The makefile you will be customizing is called Makefile.settings. This includes all the necessary details to change your compilation to your liking. Please do not change the main makefile as we will be using the original during grading. If there is something you need access to that you can't get using this system contact Matthew Schlegel and we'll figure out a solution.
The first three variables you need to notice in makefile.settings are INCLUDE, LIBS, and FILES.
INCLUDE: Where the header files for the libraries used (such as gsl) are located. LIBS: Which libraries to link against when compiling. FILES: Your files to compile.
NOTE: A note on the extension names for SimpleAgent, SimpleEnv, and SimpleExp. The .cxx is used for files if you want to rely on the makefile to manage your build type. You can replace these with .c or .cpp, but make sure you compile for c or cpp respectively and ensure they are the same type (see below).
There are several options in the makefile you can tweak if you wish but the given makefile can compile for both c and cpp
out of the box. The versions used are the default versions compiled by your gcc/g++ (you can change this using EXTRA_CFLAGS or EXTRA_CPPFLAGS through make EXTRA_CPPFLAGS=-std=c++11
or by setting EXTRA_CPPFLAGS=-std=c++11 in Makefile.settings).
To compile for c you are done and can just use make as normal.
make
To use cpp there are two options. Either you can use the command
make language_selection=cpp
or your can tweak the make file at line 48-51 to
#cpp
language_selection ?= cpp
#c
#language_selection ?= c
Finally you can change your compiler for c and cpp at lines 52 and 53, but I recommend using gcc and g++ on silo/sharks to test your code before submitting.
this contains a simple environment implementation and what you should base your environments on during this class. There are several functions and variables you should notice.
The env_init function manages the initialization of the environment at the beginning of the program. It is invoked during the RL_init(...) call. You should initialize most if not all the dynamic memory your environment needs.
The env_start function is called at the beginning of a run of the experiment. It is invoked during the RL_start function and should return the initial observation of the environment.
This is the meat of the environment and where most of an experiment will take place. This should update the environment based on the given action, and return the local reward_observation_terminal_t* (see the RL_common.h for the type definition).
This function is called at the end of an experiment and should deallocate any memory dynamically allocated by the environment.
This function is used for sending messages from your experiment to your environment
this contains a simple agent implementation and what you should base your agents on during this class. There are several functions and variables you should notice.
The agent_init function manages the initialization of the agent at the beginning of the program. It is invoked during the RL_init(...) call. You should initialize most if not all the dynamic memory your agent needs.
The agent_start function is called at the beginning of a run of the experiment. It is invoked after the environment makes its first observation during the RL_start(...) function. You should initialize what you need here but should typically not allocate any memory.
This function also returns an action_t*, which is a gsl vector which contains the next action to be sent to the environment.
This is the meat of the agent and where most of the learning takes place. You will implement various RL algorithms here.
This function also returns an action_t*, which is a gsl vector which contains the next action to be sent to the environment.
This function is called at the end of an episode.
This function is called at the end of an experiment and should deallocate any memory dynamically allocated by the agent.
This function is used for sending messages across your environment, agent and experiment.
This file contains a basic episode based RL experiment.
These files are a simple way of performing a parameter sweep with the given framework. If you have any questions about this please ask. This only uses one learning parameter for a sweep but can be easily extended to include more. To run this change lines 24-26 in your Makefile.settings to
#Change this to add the files you need to compile. (Your added files while doing homework.)
# FILES = SimpleEnv.cxx SimpleAgent.cxx SimpleExp.cxx utils.c
FILES = SimpleEnv.cxx ParameterSweepAgent.cxx ParameterSweepExp.cxx utils.c
HINT: Notice how you can use your environment file for multiple different experiments and agents. You can also implement in such a way to have the experiment be reused with different agents as well.
This is just an example plot file. Please feel free using any plotting language you wish, but still include all code used for plotting.