Skip to content

Commit 3038e45

Browse files
committed
Merge branch 'master' of https://github.com/flow-project/flow into improve-tutorials
2 parents 7926787 + 919a16c commit 3038e45

30 files changed

+916
-109
lines changed

.travis.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ git:
1515
depth: 1
1616

1717
before_install:
18+
# install and run pep8 and docstyle tests
19+
- pip install pydocstyle
20+
- pydocstyle --convention numpy
21+
- pip install flake8 .
22+
- flake8 --version
23+
- flake8 --show-source
24+
1825
# Setup conda (needed for opencv, ray dependency)
1926
- wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
2027
- bash miniconda.sh -b -p $HOME/miniconda
@@ -41,17 +48,10 @@ before_install:
4148
- ls ../
4249

4350
install:
44-
- pip install flake8 .
4551
- pip install coveralls
4652
- pip install nose
4753
- pip install matplotlib
4854
- pip install jupyter
49-
- pip install pydocstyle
50-
51-
before_script:
52-
- flake8 --version
53-
- flake8 --show-source
54-
- pydocstyle --convention numpy
5555

5656
script:
5757
- python setup.py install

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
[![Build Status](https://travis-ci.com/flow-project/flow.svg?branch=master)](https://travis-ci.com/flow-project/flow)
44
[![Docs](https://readthedocs.org/projects/flow/badge)](http://flow.readthedocs.org/en/latest/)
55
[![Coverage Status](https://coveralls.io/repos/github/flow-project/flow/badge.svg?branch=master)](https://coveralls.io/github/flow-project/flow?branch=master)
6+
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/flow-project/flow/binder)
67
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/flow-project/flow/blob/master/LICENSE.md)
78

89
# Flow
@@ -16,6 +17,7 @@ See [our website](https://flow-project.github.io/) for more information on the a
1617
- [Documentation](https://flow.readthedocs.org/en/latest/)
1718
- [Installation instructions](http://flow.readthedocs.io/en/latest/flow_setup.html)
1819
- [Tutorials](https://github.com/flow-project/flow/tree/master/tutorials)
20+
- [Binder Build (beta)](https://mybinder.org/v2/gh/flow-project/flow/binder)
1921

2022
# Technical questions
2123

docs/source/multiagent.rst

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,20 @@ The keys of the dictionary are IDs of the agent policies.
1313

1414
**Note that you must also subclass MultiEnv.**
1515

16-
A brief example of a multiagent env:
16+
A brief example of a multiagent environment:
1717
::
1818

1919
from flow.envs.multiagent_env import MultiEnv
2020

2121
class MultiAgentAccelEnv(AccelEnv, MultiEnv):
22-
"""Example MultiAgent environment"""
22+
"""Example multiagent environment"""
2323

2424
def _apply_rl_actions(self, rl_actions):
25+
"""
26+
Apply individual agent actions.
27+
28+
:param rl_actions: dictionary of format {agent_id : action vector}.
29+
"""
2530
rl_ids = []
2631
rl_action_list = []
2732
for rl_id, action in rl_actions.items():
@@ -30,20 +35,19 @@ A brief example of a multiagent env:
3035
self.k.vehicle.apply_acceleration(rl_ids, rl_action_list)
3136

3237
def compute_reward(self, rl_actions, **kwargs):
33-
"""In this example all agents receive a reward of 10"""
38+
"""In this example, all agents receive a reward of 10"""
3439
reward_dict = {}
3540
for rl_id, action in rl_actions.items():
3641
reward_dict[rl_id] = 10
3742
return reward_dict
3843

3944
def get_state(self, **kwargs):
40-
"""Here every agent gets its speed"""
41-
# speed normalizer
45+
"""Every agent observes its own speed"""
4246
obs_dict = {}
4347
for rl_id in self.k.vehicle.get_rl_ids():
4448
obs_dict[rl_id] = self.k.vehicle.get_speed(rl_id)
4549
return obs_dict
4650

4751

4852
For further details look at our
49-
`Multiagent examples <https://github.com/flow-project/flow/tree/master/examples/rllib/multiagent_exps>`_.
53+
`multiagent examples <https://github.com/flow-project/flow/tree/master/examples/rllib/multiagent_exps>`_.

examples/rllab/stabilizing_the_ring.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
from flow.scenarios.loop import LoopScenario
1010
from flow.controllers import RLController, IDMController, ContinuousRouter
11-
from flow.core.params import VehicleParams
11+
from flow.core.params import VehicleParams, SumoCarFollowingParams
1212
from flow.core.params import SumoParams, EnvParams, NetParams, InitialConfig
1313
from rllab.envs.gym_env import GymEnv
1414

@@ -28,6 +28,9 @@ def run_task(*_):
2828
vehicles.add(
2929
veh_id="idm",
3030
acceleration_controller=(IDMController, {}),
31+
car_following_params=SumoCarFollowingParams(
32+
min_gap=0,
33+
),
3134
routing_controller=(ContinuousRouter, {}),
3235
num_vehicles=21)
3336

0 commit comments

Comments
 (0)