scenic.core.dynamics
Support for dynamic behaviors and modular scenarios.
Summary of Module Members
Module Attributes
Timeout in seconds after which a |
Functions
|
Classes
Dynamic behaviors of agents. |
|
An enumeration. |
|
Internal class for scenarios which can execute during dynamic simulations. |
|
|
|
Abstract class with common code for behaviors and modular scenarios. |
|
Monitors for dynamic simulations. |
Exceptions
Abstract exception raised when a guard of a behavior is violated. |
|
Exception raised when an invariant is violated |
|
Exception raised when a precondition is violated |
|
Warning issued when a behavior/scenario may have gotten stuck. |
Member Details
- exception StuckBehaviorWarning[source]
Bases:
UserWarning
Warning issued when a behavior/scenario may have gotten stuck.
When a behavior or compose block of a modular scenario executes for a long time without yielding control, there is no way to tell whether it has entered an infinite loop with no take/wait statements, or is actually doing some long computation. But since forgetting a wait statement in a wait loop is an easy mistake, we raise this warning after a behavior/scenario has run for
stuckBehaviorWarningTimeout
seconds without yielding.
- stuckBehaviorWarningTimeout = 10
Timeout in seconds after which a
StuckBehaviorWarning
will be raised.
- class Invocable(*args, **kwargs)[source]
Abstract class with common code for behaviors and modular scenarios.
Both of these types of objects can be called like functions, can have guards, and can suspend their own execution to invoke sub-behaviors/scenarios.
- class DynamicScenario(*args, **kwargs)[source]
Bases:
Invocable
Internal class for scenarios which can execute during dynamic simulations.
Provides additional information complementing
Scenario
, which originally only supported static scenarios. The two classes should probably eventually be merged.- classmethod _requiresArguments()[source]
Whether this scenario cannot be instantiated without arguments.
- _prepare(delayPreconditionCheck=False)[source]
Prepare the scenario for execution, executing its setup block.
- _step()[source]
Execute the (already-started) scenario for one time step.
- Returns:
None
if the scenario will continue executing; otherwise a string describing why it has terminated.
- _addRequirement(ty, reqID, req, line, name, prob)[source]
Save a requirement defined at compile-time for later processing.
- class Behavior(*args, **kwargs)[source]
-
Dynamic behaviors of agents.
Behavior statements are translated into definitions of subclasses of this class.
- class Monitor(*args, **kwargs)[source]
Bases:
Behavior
Monitors for dynamic simulations.
Monitor statements are translated into definitions of subclasses of this class.
- exception GuardViolation(behavior, lineno)[source]
Bases:
Exception
Abstract exception raised when a guard of a behavior is violated.
This will never be raised directly; either of the subclasses
PreconditionViolation
orInvariantViolation
will be used, as appropriate.
- exception PreconditionViolation(behavior, lineno)[source]
Bases:
GuardViolation
Exception raised when a precondition is violated
Raised when a precondition is violated when invoking a behavior or when a precondition encounters a
RejectionException
, so that rejections count as precondition violations.
- exception InvariantViolation(behavior, lineno)[source]
Bases:
GuardViolation
Exception raised when an invariant is violated
Raised when an invariant is violated when invoking/resuming a behavior or when an invariant encounters a
RejectionException
, so that rejections count as invariant violations.