smarts.core.signal_provider module

class smarts.core.signal_provider.SignalProvider[source]

A SignalProvider manages traffic light signals.

property actions: Set[ActionSpaceType]

The action spaces of the provider.

property actor_ids: Iterable[str]

A set of actors that this provider manages.

Returns:

The actors this provider manages.

Return type:

Iterable[str]

add_actor(provider_actor: ActorState, from_provider: Provider | None = None)[source]

Management of the actor with state is being assigned (or transferred if from_provider is not None) to this Provider. Should only be called if can_accept_actor() has returned True.

can_accept_actor(state: ActorState) bool[source]

Whether this Provider can take control of an existing actor with state that was previously managed by another Provider. The state.role field should indicate the desired role, not the previous role.

manages_actor(actor_id: str) bool[source]

Returns True if the actor referenced by actor_id is managed by this Provider.

property recovery_flags: ProviderRecoveryFlags

Flags specifying what this provider should do if it fails. (May be overridden by child classes.)

reset()[source]

Reset this provider to a pre-initialized state.

set_manager(manager: ProviderManager)[source]

Indicate the manager that this provider should inform of all actor hand-offs.

setup(scenario: Scenario) ProviderState[source]

Initialize the provider with a scenario.

step(actions, dt: float, elapsed_sim_time: float) ProviderState[source]

Progress the provider to generate new actor state. :param actions: one or more valid actions from the supported action_spaces of this provider :param dt: time (in seconds) to simulate during this simulation step :type dt: float :param elapsed_sim_time: amount of time (in seconds) that’s elapsed so far in the simulation :type elapsed_sim_time: float

Returns:

State representation of all actors this manages.

Return type:

ProviderState

stop_managing(actor_id: str)[source]

Tells the Provider to stop managing the specified actor; it will be managed by another Provider now.

sync(provider_state: ProviderState)[source]

Synchronize with state managed by other Providers.

teardown()[source]

Clean up provider resources.