-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
96 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/usr/bin/env python | ||
""" | ||
Getting Started Tutorial for RLPy | ||
================================= | ||
This file contains a very basic example of a RL experiment: | ||
A simple Grid-World. | ||
""" | ||
__author__ = "Robert H. Klein" | ||
from rlpy.Domains import GridWorld | ||
from rlpy.Agents import Q_Learning | ||
from rlpy.Representations import Tabular | ||
from rlpy.Policies import eGreedy | ||
from rlpy.Experiments import Experiment | ||
import os | ||
|
||
|
||
def make_experiment(exp_id=1, path="./Results/Tutorial/gridworld-qlearning"): | ||
""" | ||
Each file specifying an experimental setup should contain a | ||
make_experiment function which returns an instance of the Experiment | ||
class with everything set up. | ||
@param id: number used to seed the random number generators | ||
@param path: output directory where logs and results are stored | ||
""" | ||
opt = {} | ||
opt["exp_id"] = exp_id | ||
opt["path"] = path | ||
|
||
# Domain: | ||
maze = os.path.join(GridWorld.default_map_dir, '4x5.txt') | ||
domain = GridWorld(maze, noise=0.3) | ||
opt["domain"] = domain | ||
|
||
# Representation | ||
representation = Tabular(domain, discretization=20) | ||
|
||
# Policy | ||
policy = eGreedy(representation, epsilon=0.2) | ||
|
||
# Agent | ||
opt["agent"] = Q_Learning(representation=representation, policy=policy, | ||
discount_factor=domain.discount_factor, | ||
initial_learn_rate=0.1, | ||
learn_rate_decay_mode="boyan", boyan_N0=100, | ||
lambda_=0.) | ||
opt["checks_per_policy"] = 100 | ||
opt["max_steps"] = 2000 | ||
opt["num_policy_checks"] = 10 | ||
experiment = Experiment(**opt) | ||
return experiment | ||
|
||
if __name__ == '__main__': | ||
from rlpy.Tools.run import run_profiled | ||
run_profiled(make_experiment, '.', 'gridworld.pdf') |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,22 +6,9 @@ | |
from Cython.Distutils import build_ext | ||
import numpy | ||
import os | ||
import re | ||
import sys | ||
|
||
|
||
def get_version_string(): | ||
# Grab the version string from the documentation. | ||
conf_fn = os.path.join(os.path.dirname(__file__), 'doc', 'conf.py') | ||
VERSION_PATTERN = re.compile("release = '([^']+)'") | ||
with open(conf_fn) as source: | ||
for line in source: | ||
match = VERSION_PATTERN.search(line) | ||
if match: | ||
return match.group(1) | ||
raise ValueError('Could not extract release version from sphinx doc') | ||
|
||
version = get_version_string() | ||
version = '1.3.1' | ||
|
||
if sys.platform == 'darwin': | ||
# by default use clang++ as this most likely to have c++11 support | ||
|
@@ -37,7 +24,8 @@ def get_version_string(): | |
maintainer="Christoph Dann", | ||
maintainer_email="[email protected]", | ||
license="BSD 3-clause", | ||
description="Value-Function-Based Reinforcement-Learning Library for Education and Research", | ||
description="Value-Function-Based Reinforcement-Learning Library for" | ||
+ " Education and Research", | ||
url="http://acl.mit.edu/rlpy/", | ||
classifiers=['Intended Audience :: Science/Research', | ||
'Intended Audience :: Developers', | ||
|
@@ -54,14 +42,16 @@ def get_version_string(): | |
], | ||
long_description=open('README.rst').read(), | ||
packages=find_packages(), | ||
package_data={'rlpy': [ | ||
'Domains/GridWorldMaps/*.txt', | ||
'Domains/IntruderMonitoringMaps/*.txt', | ||
'Domains/PinballConfigs/*.cfg', | ||
'Domains/PacmanPackage/layouts/*.lay', | ||
'Domains/SystemAdministratorMaps/*.txt', | ||
"Representations/c_kernels.h", | ||
]}, | ||
include_package_data=True, | ||
# package_data={'rlpy': [ | ||
# 'Domains/GridWorldMaps/*.txt', | ||
# 'Domains/IntruderMonitoringMaps/*.txt', | ||
# 'Domains/PinballConfigs/*.cfg', | ||
# 'Domains/PacmanPackage/layouts/*.lay', | ||
# 'Domains/SystemAdministratorMaps/*.txt', | ||
# "Representations/c_kernels.h", | ||
# ] | ||
# }, | ||
install_requires=[ | ||
'numpy >= 1.7', | ||
'scipy', | ||
|