-
Notifications
You must be signed in to change notification settings - Fork 388
changed _departed_ids, and _arrived_ids in the update function #926
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
Conversation
flow/core/kernel/vehicle/traci.py
Outdated
"""See parent class.""" | ||
if len(self._arrived_ids) > 0: | ||
return self._arrived_ids[-1] | ||
return self._arrived_ids |
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.
why this change? this affects a lot of the codebase. Otherwise LGTM
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.
self._arrived_ids was a list storing ids for each step. in this function we just want the ids in the last step ([-1]). Since I don't have a list anymore, I deleted [-1].
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.
So if it's not a list anymore why does it have a len method?
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.
good catch!
flow/core/kernel/vehicle/traci.py
Outdated
"""See parent class.""" | ||
if len(self._departed_ids) > 0: | ||
return self._departed_ids[-1] | ||
return self._departed_ids |
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.
same here
Pull Request Test Coverage Report for Build 5866
💛 - Coveralls |
self._num_departed.append(sim_obs[tc.VAR_LOADED_VEHICLES_NUMBER]) | ||
self._num_arrived.append(sim_obs[tc.VAR_ARRIVED_VEHICLES_NUMBER]) |
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.
as long as there is a getter for these, this LGTM
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.
LGTM
* changed _departed_ids, and _arrived_ids in the update function * fixed bug in get_departed_ids and get_arrived_ids
* changed _departed_ids, and _arrived_ids in the update function * fixed bug in get_departed_ids and get_arrived_ids
Pull request information
Description
In vehicle/traci, we are storing all departed and arrived vehicle IDs for each simulation step. Every simulation step we are appending new vehicle list to _departed_ids and _arrived_ids. In large networks or high horizon times, this can be expensive and results in significant slow down. I changed _departed_ids and _arrived_ids to just store the current ids. I didn't totally delete them since we may need them (e.g., as in MultiEnv)