Skip to content
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

Merged
merged 8 commits into from
Apr 4, 2023
Merged

Add actor alive interface #1919

merged 8 commits into from
Apr 4, 2023

Conversation

Gamenot
Copy link
Collaborator

@Gamenot Gamenot commented Mar 24, 2023

This is intended to allow an agent to become done on actors of interest leaving the simulation.

@Gamenot Gamenot marked this pull request as ready for review March 28, 2023 13:03
Comment on lines 239 to +242
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."""
Copy link
Member

@Adaickalavan Adaickalavan Mar 28, 2023

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.

Copy link
Collaborator Author

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.

Copy link
Member

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]

# 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.

Copy link
Member

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.

class ActorsAliveDoneCriteria:
"""Require actors to persist."""

actors_of_interest: str = r""
Copy link
Member

@Adaickalavan Adaickalavan Mar 28, 2023

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?

Copy link
Collaborator Author

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Broken up.

smarts/core/sensors.py Outdated Show resolved Hide resolved
@Gamenot Gamenot merged commit ed3e52f into master Apr 4, 2023
@Gamenot Gamenot deleted the tucker/actor-alive branch April 4, 2023 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants