-
Notifications
You must be signed in to change notification settings - Fork 389
Multi lane bug fix #153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multi lane bug fix #153
Changes from all commits
4956dc4
323705e
d5156f2
855fb55
2c20049
d21f812
c0c17f2
1357bf6
7736472
ae7ecb2
1809b06
33b394a
b9b2228
6982464
d0935c3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,8 @@ | |
| "lanes": 4, | ||
| # speed limit for all edges | ||
| "speed_limit": 30, | ||
| # number of edges to divide the highway into | ||
| "num_edges": 1 | ||
| } | ||
|
|
||
|
|
||
|
|
@@ -39,11 +41,36 @@ def __init__(self, | |
|
|
||
| self.length = net_params.additional_params["length"] | ||
| self.lanes = net_params.additional_params["lanes"] | ||
| self.num_edges = net_params.additional_params.get("num_edges", 1) | ||
|
|
||
| super().__init__(name, generator_class, vehicles, net_params, | ||
| initial_config, traffic_lights) | ||
|
|
||
| def specify_edge_starts(self): | ||
| """See parent class.""" | ||
| edgestarts = [("highway", 0)] | ||
| edgestarts = [("highway_{}".format(i), 0) | ||
| for i in range(self.num_edges)] | ||
| return edgestarts | ||
|
|
||
| def gen_custom_start_pos(self, initial_config, num_vehicles, **kwargs): | ||
| """Generate a user defined set of starting positions. | ||
| This method is just used for testing. | ||
|
|
||
| Parameters | ||
| ---------- | ||
| initial_config : InitialConfig type | ||
| see flow/core/params.py | ||
| num_vehicles : int | ||
| number of vehicles to be placed on the network | ||
| kwargs : dict | ||
| extra components, usually defined during reset to overwrite initial | ||
| config parameters | ||
|
|
||
| Returns | ||
| ------- | ||
| startpositions : list of tuple (float, float) | ||
| list of start positions [(edge0, pos0), (edge1, pos1), ...] | ||
| startlanes : list of int | ||
| list of start lanes | ||
| """ | ||
| return kwargs["start_positions"], kwargs["start_lanes"] | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we want this for all scenarios? if so, would be a good idea to create an issue about this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems like a one-off at the moment? I don't see a compelling case for carefully specifying the initial position of vehicles but happy to be convinced otherwise |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sort of at a high level, why do we want to cut the highway into sections?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This lets me write tests for the methods that get leaders for subsequent edges; doing this to highways seemed like the cleanest way to test the non-junction version of this