Skip to content

Commit c8ea2b0

Browse files
Merge pull request #517 from flow-project/time_space_diagram
Time space diagram - added a method for plotting time-space diagrams - using the time-space diagrams to modify the vehicle parameters in the simulations to match expected behaviors in new sumo (more on this to come) - tests for the new time-space diagram plotter
2 parents 3bfe67e + 748a67b commit c8ea2b0

17 files changed

+1404
-11
lines changed

examples/rllab/figure_eight.py

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ def run_task(*_):
2727
routing_controller=(ContinuousRouter, {}),
2828
car_following_params=SumoCarFollowingParams(
2929
speed_mode="obey_safe_speed",
30+
decel=1.5,
3031
),
3132
num_vehicles=1)
3233
vehicles.add(
@@ -37,6 +38,7 @@ def run_task(*_):
3738
routing_controller=(ContinuousRouter, {}),
3839
car_following_params=SumoCarFollowingParams(
3940
speed_mode="obey_safe_speed",
41+
decel=1.5,
4042
),
4143
num_vehicles=13)
4244

examples/rllib/figure_eight.py

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
routing_controller=(ContinuousRouter, {}),
3636
car_following_params=SumoCarFollowingParams(
3737
speed_mode="obey_safe_speed",
38+
decel=1.5,
3839
),
3940
num_vehicles=13)
4041
vehicles.add(
@@ -43,6 +44,7 @@
4344
routing_controller=(ContinuousRouter, {}),
4445
car_following_params=SumoCarFollowingParams(
4546
speed_mode="obey_safe_speed",
47+
decel=1.5,
4648
),
4749
num_vehicles=1)
4850

examples/sumo/figure_eight.py

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ def figure_eight_example(render=None):
4141
routing_controller=(ContinuousRouter, {}),
4242
car_following_params=SumoCarFollowingParams(
4343
speed_mode="obey_safe_speed",
44+
decel=1.5,
4445
),
4546
initial_speed=0,
4647
num_vehicles=14)

flow/benchmarks/figureeight0.py

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
routing_controller=(ContinuousRouter, {}),
3030
car_following_params=SumoCarFollowingParams(
3131
speed_mode="obey_safe_speed",
32+
decel=1.5,
3233
),
3334
num_vehicles=13)
3435
vehicles.add(

flow/benchmarks/figureeight1.py

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
routing_controller=(ContinuousRouter, {}),
3131
car_following_params=SumoCarFollowingParams(
3232
speed_mode="obey_safe_speed",
33+
decel=1.5,
3334
),
3435
num_vehicles=1)
3536
vehicles.add(

flow/scenarios/merge.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ def specify_nodes(self, net_params):
9999
{
100100
"id": "center",
101101
"y": 0,
102-
"x": premerge
102+
"x": premerge,
103+
"radius": 10
103104
},
104105
{
105106
"id": "right",
@@ -196,11 +197,11 @@ def specify_edge_starts(self):
196197
postmerge = self.net_params.additional_params["post_merge_length"]
197198

198199
edgestarts = [("inflow_highway", 0), ("left", INFLOW_EDGE_LEN + 0.1),
199-
("center", INFLOW_EDGE_LEN + premerge + 8.1),
200+
("center", INFLOW_EDGE_LEN + premerge + 22.6),
200201
("inflow_merge",
201-
INFLOW_EDGE_LEN + premerge + postmerge + 8.1),
202+
INFLOW_EDGE_LEN + premerge + postmerge + 22.6),
202203
("bottom",
203-
2 * INFLOW_EDGE_LEN + premerge + postmerge + 8.2)]
204+
2 * INFLOW_EDGE_LEN + premerge + postmerge + 22.7)]
204205

205206
return edgestarts
206207

@@ -212,7 +213,7 @@ def specify_internal_edge_starts(self):
212213
internal_edgestarts = [
213214
(":left", INFLOW_EDGE_LEN), (":center",
214215
INFLOW_EDGE_LEN + premerge + 0.1),
215-
(":bottom", 2 * INFLOW_EDGE_LEN + premerge + postmerge + 8.1)
216+
(":bottom", 2 * INFLOW_EDGE_LEN + premerge + postmerge + 22.6)
216217
]
217218

218219
return internal_edgestarts

flow/utils/registry.py

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def make_create_env(params, version=0, render=None):
3232
- exp_tag: name of the experiment
3333
- env_name: name of the flow environment the experiment is running on
3434
- scenario: name of the scenario class the experiment uses
35+
- simulator: simulator that is used by the experiment (e.g. aimsun)
3536
- sim: simulation-related parameters (see flow.core.params.SimParams)
3637
- env: environment related parameters (see flow.core.params.EnvParams)
3738
- net: network-related parameters (see flow.core.params.NetParams and

flow/utils/rllib.py

+25-5
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,37 @@ def get_flow_params(config):
5757
5858
Parameters
5959
----------
60-
config : dict
61-
stored RLlib configuration dict
60+
config : dict < dict > or str
61+
May be one of two things:
62+
63+
* If it is a dict, then it is the stored RLlib configuration dict.
64+
* If it is a string, then it is the path to a flow_params json file.
6265
6366
Returns
6467
-------
6568
dict
66-
Dict of flow parameters, like net_params, env_params, vehicle
67-
characteristics, etc
69+
flow-related parameters, consisting of the following keys:
70+
71+
* exp_tag: name of the experiment
72+
* env_name: name of the flow environment the experiment is running on
73+
* scenario: name of the scenario class the experiment uses
74+
* simulator: simulator that is used by the experiment (e.g. aimsun)
75+
* sim: simulation-related parameters (see flow.core.params.SimParams)
76+
* env: environment related parameters (see flow.core.params.EnvParams)
77+
* net: network-related parameters (see flow.core.params.NetParams and
78+
the scenario's documentation or ADDITIONAL_NET_PARAMS component)
79+
* veh: vehicles to be placed in the network at the start of a rollout
80+
(see flow.core.params.VehicleParams)
81+
* initial: parameters affecting the positioning of vehicles upon
82+
initialization/reset (see flow.core.params.InitialConfig)
83+
* tls: traffic lights to be introduced to specific nodes (see
84+
flow.core.params.TrafficLightParams)
6885
"""
6986
# collect all data from the json file
70-
flow_params = json.loads(config['env_config']['flow_params'])
87+
if type(config) == dict:
88+
flow_params = json.loads(config['env_config']['flow_params'])
89+
else:
90+
flow_params = json.load(open(config, 'r'))
7191

7292
# reinitialize the vehicles class from stored data
7393
veh = VehicleParams()

flow/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""Specifies the current version number of Flow."""
22

3-
__version__ = "0.3.0"
3+
__version__ = "0.3.1"

0 commit comments

Comments
 (0)