Skip to content

Commit 4b35c0c

Browse files
authored
Merge pull request #2 from imimali/add-missing-files
Add missing files
2 parents d2a5f62 + ef75dff commit 4b35c0c

File tree

43 files changed

+1142
-14
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1142
-14
lines changed

A Complete Reinforcement Learning System(Capstone)/work/.hidden

-1
This file was deleted.

A Complete Reinforcement Learning System(Capstone)/work/.readonly

-1
This file was deleted.

A Complete Reinforcement Learning System(Capstone)/work/week1/environment.py

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
#!/usr/bin/env python
2+
3+
"""Abstract environment base class for RL-Glue-py.
4+
"""
5+
6+
from __future__ import print_function
7+
8+
from abc import ABCMeta, abstractmethod
9+
10+
11+
class BaseEnvironment:
12+
"""Implements the environment for an RLGlue environment
13+
14+
Note:
15+
env_init, env_start, env_step, env_cleanup, and env_message are required
16+
methods.
17+
"""
18+
19+
__metaclass__ = ABCMeta
20+
21+
def __init__(self):
22+
reward = None
23+
observation = None
24+
termination = None
25+
self.reward_obs_term = (reward, observation, termination)
26+
27+
@abstractmethod
28+
def env_init(self, env_info={}):
29+
"""Setup for the environment called when the experiment first starts.
30+
31+
Note:
32+
Initialize a tuple with the reward, first state observation, boolean
33+
indicating if it's terminal.
34+
"""
35+
36+
@abstractmethod
37+
def env_start(self):
38+
"""The first method called when the experiment starts, called before the
39+
agent starts.
40+
41+
Returns:
42+
The first state observation from the environment.
43+
"""
44+
45+
@abstractmethod
46+
def env_step(self, action):
47+
"""A step taken by the environment.
48+
49+
Args:
50+
action: The action taken by the agent
51+
52+
Returns:
53+
(float, state, Boolean): a tuple of the reward, state observation,
54+
and boolean indicating if it's terminal.
55+
"""
56+
57+
@abstractmethod
58+
def env_cleanup(self):
59+
"""Cleanup done after the environment ends"""
60+
61+
@abstractmethod
62+
def env_message(self, message):
63+
"""A message asking the environment for information
64+
65+
Args:
66+
message: the message passed to the environment
67+
68+
Returns:
69+
the response (or answer) to the message
70+
"""
71+

A Complete Reinforcement Learning System(Capstone)/work/week1/lunar_landar.png

-1
This file was deleted.

A Complete Reinforcement Learning System(Capstone)/work/week1/lunar_landar_1.png

-1
This file was deleted.

A Complete Reinforcement Learning System(Capstone)/work/week1/lunar_landar_2.png

-1
This file was deleted.

A Complete Reinforcement Learning System(Capstone)/work/week1/lunar_landar_3.png

-1
This file was deleted.

A Complete Reinforcement Learning System(Capstone)/work/week1/lunar_landar_4.png

-1
This file was deleted.

A Complete Reinforcement Learning System(Capstone)/work/week1/lunar_landar_5.png

-1
This file was deleted.

A Complete Reinforcement Learning System(Capstone)/work/week1/utils.py

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
def get_velocity(action):
2+
if action == 1:
3+
return 12, 15
4+
if action == 2:
5+
return 10, 10
6+
if action == 3:
7+
return 0, 0
8+
if action == 4:
9+
return 12, 15
10+
if action == 5:
11+
return 0, 0
12+
13+
def get_angle(action):
14+
if action == 1:
15+
return 0
16+
if action == 2:
17+
return 15
18+
if action == 3:
19+
return 0
20+
if action == 4:
21+
return 0
22+
if action == 5:
23+
return 0
24+
25+
def get_position(action):
26+
if action == 1:
27+
return 10, 100
28+
if action == 2:
29+
return 50, 0
30+
if action == 3:
31+
return 50, 0
32+
if action == 4:
33+
return 50, 20
34+
if action == 5:
35+
return 2, 0
36+
37+
def get_landing_zone():
38+
return 50, 0
39+
40+
def get_fuel(action):
41+
if action == 1:
42+
return 10
43+
if action == 2:
44+
return 20
45+
if action == 3:
46+
return 5
47+
if action == 4:
48+
return 0
49+
if action == 5:
50+
return 10
51+
52+
def tests(LunarLander, test_number):
53+
ll = LunarLander()
54+
ll.env_start()
55+
reward, obs, term = ll.env_step(test_number)
56+
print("Reward: {}, Terminal: {}".format(reward, term))
57+

A Complete Reinforcement Learning System(Capstone)/work/week5/3000_episodes.png

-1
This file was deleted.

A Complete Reinforcement Learning System(Capstone)/work/week5/ImplementYourAgent.mp4

-1
This file was deleted.

A Complete Reinforcement Learning System(Capstone)/work/week5/agent.py

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#!/usr/bin/env python
2+
3+
"""An abstract class that specifies the Agent API for RL-Glue-py.
4+
"""
5+
6+
from __future__ import print_function
7+
from abc import ABCMeta, abstractmethod
8+
9+
10+
class BaseAgent:
11+
"""Implements the agent for an RL-Glue environment.
12+
Note:
13+
agent_init, agent_start, agent_step, agent_end, agent_cleanup, and
14+
agent_message are required methods.
15+
"""
16+
17+
__metaclass__ = ABCMeta
18+
19+
def __init__(self):
20+
pass
21+
22+
@abstractmethod
23+
def agent_init(self, agent_info= {}):
24+
"""Setup for the agent called when the experiment first starts."""
25+
26+
@abstractmethod
27+
def agent_start(self, observation):
28+
"""The first method called when the experiment starts, called after
29+
the environment starts.
30+
Args:
31+
observation (Numpy array): the state observation from the environment's env_start function.
32+
Returns:
33+
The first action the agent takes.
34+
"""
35+
36+
@abstractmethod
37+
def agent_step(self, reward, observation):
38+
"""A step taken by the agent.
39+
Args:
40+
reward (float): the reward received for taking the last action taken
41+
observation (Numpy array): the state observation from the
42+
environment's step based, where the agent ended up after the
43+
last step
44+
Returns:
45+
The action the agent is taking.
46+
"""
47+
48+
@abstractmethod
49+
def agent_end(self, reward):
50+
"""Run when the agent terminates.
51+
Args:
52+
reward (float): the reward the agent received for entering the terminal state.
53+
"""
54+
55+
@abstractmethod
56+
def agent_cleanup(self):
57+
"""Cleanup done after the agent ends."""
58+
59+
@abstractmethod
60+
def agent_message(self, message):
61+
"""A function used to pass information from the agent to the experiment.
62+
Args:
63+
message: The message passed to the agent.
64+
Returns:
65+
The response (or answer) to the message.
66+
"""

A Complete Reinforcement Learning System(Capstone)/work/week5/asserts/agent_end_output_0.npz

-1
This file was deleted.

A Complete Reinforcement Learning System(Capstone)/work/week5/asserts/agent_end_output_1.npz

-1
This file was deleted.

A Complete Reinforcement Learning System(Capstone)/work/week5/asserts/agent_end_output_2.npz

-1
This file was deleted.

A Complete Reinforcement Learning System(Capstone)/work/week5/asserts/agent_end_output_3.npz

-1
This file was deleted.

A Complete Reinforcement Learning System(Capstone)/work/week5/asserts/agent_end_output_4.npz

-1
This file was deleted.

A Complete Reinforcement Learning System(Capstone)/work/week5/asserts/agent_input_1.npz

-1
This file was deleted.

A Complete Reinforcement Learning System(Capstone)/work/week5/asserts/agent_input_2.npz

-1
This file was deleted.

A Complete Reinforcement Learning System(Capstone)/work/week5/asserts/agent_step_output_0.npz

-1
This file was deleted.

A Complete Reinforcement Learning System(Capstone)/work/week5/asserts/agent_step_output_1.npz

-1
This file was deleted.

A Complete Reinforcement Learning System(Capstone)/work/week5/asserts/agent_step_output_2.npz

-1
This file was deleted.

A Complete Reinforcement Learning System(Capstone)/work/week5/asserts/agent_step_output_3.npz

-1
This file was deleted.

A Complete Reinforcement Learning System(Capstone)/work/week5/asserts/agent_step_output_4.npz

-1
This file was deleted.

A Complete Reinforcement Learning System(Capstone)/work/week5/asserts/get_td_error_1.npz

-1
This file was deleted.

A Complete Reinforcement Learning System(Capstone)/work/week5/asserts/optimize_network_input_1.npz

-1
This file was deleted.

A Complete Reinforcement Learning System(Capstone)/work/week5/asserts/optimize_network_output_1.npz

-1
This file was deleted.

A Complete Reinforcement Learning System(Capstone)/work/week5/asserts/update_weights.npz

-1
This file was deleted.

A Complete Reinforcement Learning System(Capstone)/work/week5/environment.py

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#!/usr/bin/env python
2+
3+
"""Abstract environment base class for RL-Glue-py.
4+
"""
5+
6+
from __future__ import print_function
7+
8+
from abc import ABCMeta, abstractmethod
9+
10+
11+
class BaseEnvironment:
12+
"""Implements the environment for an RLGlue environment
13+
14+
Note:
15+
env_init, env_start, env_step, env_cleanup, and env_message are required
16+
methods.
17+
"""
18+
19+
__metaclass__ = ABCMeta
20+
21+
def __init__(self):
22+
reward = None
23+
observation = None
24+
termination = None
25+
self.reward_obs_term = (reward, observation, termination)
26+
27+
@abstractmethod
28+
def env_init(self, env_info={}):
29+
"""Setup for the environment called when the experiment first starts.
30+
31+
Note:
32+
Initialize a tuple with the reward, first state observation, boolean
33+
indicating if it's terminal.
34+
"""
35+
36+
@abstractmethod
37+
def env_start(self):
38+
"""The first method called when the experiment starts, called before the
39+
agent starts.
40+
41+
Returns:
42+
The first state observation from the environment.
43+
"""
44+
45+
@abstractmethod
46+
def env_step(self, action):
47+
"""A step taken by the environment.
48+
49+
Args:
50+
action: The action taken by the agent
51+
52+
Returns:
53+
(float, state, Boolean): a tuple of the reward, state observation,
54+
and boolean indicating if it's terminal.
55+
"""
56+
57+
@abstractmethod
58+
def env_cleanup(self):
59+
"""Cleanup done after the environment ends"""
60+
61+
@abstractmethod
62+
def env_message(self, message):
63+
"""A message asking the environment for information
64+
65+
Args:
66+
message: the message passed to the environment
67+
68+
Returns:
69+
the response (or answer) to the message
70+
"""

A Complete Reinforcement Learning System(Capstone)/work/week5/lunar_lander.py

-1
This file was deleted.

0 commit comments

Comments
 (0)