-
Notifications
You must be signed in to change notification settings - Fork 190
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
Add actor alive interface #1919
Conversation
1e585fa
to
d48ee8f
Compare
agents_alive: Optional[AgentsAliveDoneCriteria] = None | ||
"""If set, triggers the ego agent to be done based on the number of active agents for multi-agent purposes.""" | ||
actors_alive: Optional[ActorsAliveDoneCriteria] = None | ||
"""If set, triggers the ego agent to be done based on actors existing in the simulation.""" |
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.
If possible, it might be better to combine or unify agents_alive
and actors_alive
options together into one event configuration, because separate agents_alive
and actors_alive
options might conflict.
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.
I think what you are considering is the difference between AND and OR causing termination. It is slightly difficult to satisfy these complex cases without introducing expressions.
I think we do not have the case for AND currently.
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.
When we use a single env to cater to two types of scenarios, namely (i) one which uses and terminates with the social agent as the leader, and (ii) one which uses and terminates with the sumo vehicle as the leader, we end up with a code which looks like
[Assume lines 151 to 158 are uncommented]
SMARTS/smarts/env/gymnasium/platoon_env.py
Lines 151 to 163 in 7cdc5c3
# agents_alive=AgentsAliveDoneCriteria( | |
# agent_lists_alive=[ | |
# AgentsListAlive( | |
# agents_list=["social-agent-leader-Leader-007"], | |
# minimum_agents_alive_in_list=1, | |
# ) | |
# ] | |
# ), | |
actors_alive=ActorsAliveDoneCriteria( | |
actors_of_interest="Leader-007", | |
strict=True, | |
), | |
) |
Here, the env will terminate immediately every time as one of the done criteria, namely actors_alive
or agents_alive
will become true immediately at the start of the every scenario.
Another issue here is the name of vehicle of interest differs in both scenarios, because social-agent-leader
string gets prefixed to the agent name when using social agent as the leader.
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.
We could modify an exisiting test or add a new test to check for the actors alive done criteria.
smarts/core/agent_interface.py
Outdated
class ActorsAliveDoneCriteria: | ||
"""Require actors to persist.""" | ||
|
||
actors_of_interest: str = r"" |
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.
Could we account for multiple vehicles of interest?
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 is a pattern string, so it would account based on pattern matching. I could break it up into multiple for ease of use I suppose.
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.
Broken up.
This is intended to allow an agent to become done on actors of interest leaving the simulation.