Skip to content

Commit

Permalink
remove remaining rllab (flow-project#757)
Browse files Browse the repository at this point in the history
* removed most uses of rllab. Bug pending

* added description that separate py files are needed

* bug fix

* cleanup to tutorials

Co-authored-by: Ashkan Y. <[email protected]>
  • Loading branch information
AboudyKreidieh and ashkan-software authored Jan 8, 2020
1 parent d61e0c9 commit 55e39f1
Show file tree
Hide file tree
Showing 16 changed files with 230 additions and 328 deletions.
1 change: 0 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ omit =
*__init__*
*/scripts/*
*/setup.py
*rllab*
*/flow/utils/shflags
*dummy_server.py
*aimsun.py
Expand Down
3 changes: 0 additions & 3 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ def __getattr__(cls, name):


MOCK_MODULES = [
'rllab',
"rllab.core.serializable.Serializable",
'rllab.sampler.utils.rollout',
"AAPI",
'PyANGKernel',
'AAPI.GKGUISystem',
Expand Down
15 changes: 0 additions & 15 deletions tests/fast_tests/test_visualizers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# from flow.visualize import visualizer_rllab as vs_rllab
# from flow.visualize.visualizer_rllab import visualizer_rllab
from flow.visualize import visualizer_rllib as vs_rllib
from flow.visualize.visualizer_rllib import visualizer_rllib
import flow.visualize.capacity_diagram_generator as cdg
Expand Down Expand Up @@ -55,19 +53,6 @@ def test_visualizer_multi(self):
visualizer_rllib(pass_args)


# class TestVisualizerRLlab(unittest.TestCase):
# """Tests visualizer_rllab"""
#
# def test_visualizer(self):
# # current path
# current_path = os.path.realpath(__file__).rsplit('/', 1)[0]
# arg_str = '{}/../data/rllab_data/itr_0.pkl --num_rollouts 1 ' \
# '--no_render'.format(current_path).split()
# parser = vs_rllab.create_parser()
# pass_args = parser.parse_args(arg_str)
# visualizer_rllab(pass_args)


class TestPlotters(unittest.TestCase):

def test_capacity_diagram_generator(self):
Expand Down
2 changes: 1 addition & 1 deletion tutorials/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ The content of each tutorial is as follows:
**Tutorial 3:** Running RLlib experiments for mixed-autonomy traffic.
**Tutorial 4:** Saving and visualizing resuls from non-RL simulations and
testing simulations in the presence of an RLlib/rllab agent.
testing simulations in the presence of an RLlib agent.
**Tutorial 5:** Creating custom networks.
Expand Down
4 changes: 2 additions & 2 deletions tutorials/tutorial00_flow.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.0"
"version": "3.6.8"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
}
13 changes: 1 addition & 12 deletions tutorials/tutorial01_sumo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -346,22 +346,12 @@
"metadata": {},
"outputs": [],
"source": [
"# create the network object\n",
"network = RingNetwork(name=\"ring_example\",\n",
" vehicles=vehicles,\n",
" net_params=net_params,\n",
" initial_config=initial_config,\n",
" traffic_lights=traffic_lights)\n",
"\n",
"# create the environment object\n",
"env = AccelEnv(env_params, sim_params, network)\n",
"\n",
"flow_params = dict(\n",
" exp_tag='ring_example',\n",
" env_name=AccelEnv,\n",
" network=RingNetwork,\n",
" simulator='traci',\n",
" sim=sumo_params,\n",
" sim=sim_params,\n",
" env=env_params,\n",
" net=net_params,\n",
" veh=vehicles,\n",
Expand All @@ -372,7 +362,6 @@
"# number of time steps\n",
"flow_params['env'].horizon = 3000\n",
"exp = Experiment(flow_params)\n",
"exp.env - env\n",
"\n",
"# run the sumo simulation\n",
"_ = exp.run(1, convert_to_csv=True)"
Expand Down
11 changes: 0 additions & 11 deletions tutorials/tutorial02_aimsun.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -348,16 +348,6 @@
"metadata": {},
"outputs": [],
"source": [
"# create the network object\n",
"network = RingNetwork(name=\"ring_example\",\n",
" vehicles=vehicles,\n",
" net_params=net_params,\n",
" initial_config=initial_config,\n",
" traffic_lights=traffic_lights)\n",
"\n",
"# create the environment object\n",
"env = AccelEnv(env_params, sim_params, network, simulator='aimsun')\n",
"\n",
"flow_params = dict(\n",
" exp_tag='test_network',\n",
" env_name=AccelEnv,\n",
Expand All @@ -374,7 +364,6 @@
"# number of time steps\n",
"flow_params['env'].horizon = 3000\n",
"exp = Experiment(flow_params)\n",
"exp.env = env\n",
"\n",
"# run the Aimsun simulation\n",
"_ = exp.run(1)"
Expand Down
8 changes: 3 additions & 5 deletions tutorials/tutorial04_visualize.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"collapsed": true
},
"source": [
"Visualization is different depending on which reinforcement learning library you are using, if any. Accordingly, the rest of this tutorial explains how to plot rewards, replay policies and collect data when using either no RL library, RLlib or rllab. "
"Visualization is different depending on which reinforcement learning library you are using, if any. Accordingly, the rest of this tutorial explains how to plot rewards, replay policies and collect data when using either no RL library, RLlib, or stable-baselines. "
]
},
{
Expand All @@ -63,9 +63,7 @@
"\n",
"[How to visualize using SUMO with RLlib](#2.2---Using-SUMO-with-RLlib)\n",
"\n",
"[How to visualize using SUMO with rllab](#2.3---Using-SUMO-with-rllab)\n",
"\n",
"[**_Example: visualize data on a ring trained using RLlib_**](#2.4---Example:-Visualize-data-on-a-ring-trained-using-RLlib)\n"
"[**_Example: visualize data on a ring trained using RLlib_**](#2.3---Example:-Visualize-data-on-a-ring-trained-using-RLlib)\n"
]
},
{
Expand Down Expand Up @@ -213,7 +211,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### 2.4 - Example: Visualize data on a ring trained using RLlib"
"### 2.3 - Example: Visualize data on a ring trained using RLlib"
]
},
{
Expand Down
37 changes: 13 additions & 24 deletions tutorials/tutorial05_networks.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -66,7 +66,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -98,7 +98,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -140,7 +140,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -217,7 +217,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -245,7 +245,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -273,7 +273,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -345,7 +345,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -377,7 +377,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -405,7 +405,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -423,7 +423,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -446,22 +446,12 @@
"source": [
"from flow.core.experiment import Experiment\n",
"\n",
"network = myNetwork( # we use the newly defined network class\n",
" name=\"test_network\",\n",
" vehicles=vehicles,\n",
" net_params=net_params,\n",
" initial_config=initial_config\n",
")\n",
"\n",
"# AccelEnv allows us to test any newly generated network quickly\n",
"env = AccelEnv(env_params, sim_params, network)\n",
"\n",
"flow_params = dict(\n",
" exp_tag='test_network',\n",
" env_name=AccelEnv,\n",
" network=myNetwork,\n",
" simulator='traci',\n",
" sim=sumo_params,\n",
" sim=sim_params,\n",
" env=env_params,\n",
" net=net_params,\n",
" veh=vehicles,\n",
Expand All @@ -471,7 +461,6 @@
"# number of time steps\n",
"flow_params['env'].horizon = 1500\n",
"exp = Experiment(flow_params)\n",
"exp.env = env\n",
"\n",
"# run the sumo simulation\n",
"_ = exp.run(1)"
Expand Down Expand Up @@ -501,7 +490,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.7"
"version": "3.6.8"
}
},
"nbformat": 4,
Expand Down
38 changes: 3 additions & 35 deletions tutorials/tutorial06_osm.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,7 @@
"sim_params = SumoParams(render=True)\n",
"initial_config = InitialConfig()\n",
"vehicles = VehicleParams()\n",
"vehicles.add('human', num_vehicles=100)\n",
"\n",
"# create the network\n",
"network = Network(\n",
" name='bay_bridge',\n",
" net_params=net_params,\n",
" initial_config=initial_config,\n",
" vehicles=vehicles\n",
")"
"vehicles.add('human', num_vehicles=100)"
]
},
{
Expand All @@ -115,13 +107,6 @@
"metadata": {},
"outputs": [],
"source": [
"# create the environment\n",
"env = TestEnv(\n",
" env_params=env_params,\n",
" sim_params=sim_params,\n",
" network=network\n",
")\n",
"\n",
"flow_params = dict(\n",
" exp_tag='bay_bridge',\n",
" env_name=TestEnv,\n",
Expand All @@ -137,10 +122,9 @@
"# number of time steps\n",
"flow_params['env'].horizon = 1000\n",
"exp = Experiment(flow_params)\n",
"exp.env = env\n",
"\n",
"# run the sumo simulation\n",
"exp.run(1)"
"_ = exp.run(1)"
]
},
{
Expand Down Expand Up @@ -283,21 +267,6 @@
"metadata": {},
"outputs": [],
"source": [
"# create the network\n",
"new_network = BayBridgeOSMNetwork(\n",
" name='bay_bridge',\n",
" net_params=net_params,\n",
" initial_config=new_initial_config,\n",
" vehicles=vehicles,\n",
")\n",
"\n",
"# create the environment\n",
"env = TestEnv(\n",
" env_params=env_params,\n",
" sim_params=sim_params,\n",
" network=new_network\n",
")\n",
"\n",
"flow_params = dict(\n",
" exp_tag='bay_bridge',\n",
" env_name=TestEnv,\n",
Expand All @@ -313,10 +282,9 @@
"# number of time steps\n",
"flow_params['env'].horizon = 10000\n",
"exp = Experiment(flow_params)\n",
"exp.env = env\n",
"\n",
"# run the sumo simulation\n",
"exp.run(1)"
"_ = exp.run(1)"
]
},
{
Expand Down
Loading

0 comments on commit 55e39f1

Please sign in to comment.