scenic.core.dynamics

Support for dynamic behaviors and modular scenarios.

Summary of Module Members

Functions

functionForMonitor

isAMonitorName

makeTerminationAction

monitorName

runTryInterrupt

Classes

Behavior

Dynamic behaviors of agents.

BlockConclusion

An enumeration.

DynamicScenario

Internal class for scenarios which can execute during dynamic simulations.

InterruptBlock

Invocable

Abstract class with common code for behaviors and modular scenarios.

Monitor

Monitors for dynamic simulations.

Exceptions

GuardViolation

Abstract exception raised when a guard of a behavior is violated.

InvariantViolation

Raised when an invariant is violated when invoking/resuming a behavior.

PreconditionViolation

Raised when a precondition is violated when invoking a behavior.

Member Details

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.

_invokeInner(agent, subs)[source]

Run the given sub-behavior/scenario(s) in parallel.

Implemented by subclasses.

class DynamicScenario(*args, **kwargs)[source]

Bases: scenic.core.dynamics.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.

_bindTo(scene)[source]

Bind this scenario to a sampled scene when starting a new simulation.

_prepare(delayPreconditionCheck=False)[source]

Prepare the scenario for execution, executing its setup block.

_start()[source]

Start the scenario, starting its compose block, behaviors, and monitors.

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

_stop(reason)[source]

Stop the scenario’s execution, for the given reason.

_addRequirement(ty, reqID, req, line, name, prob)[source]

Save a requirement defined at compile-time for later processing.

_addDynamicRequirement(ty, req, line, name)[source]

Add a requirement defined during a dynamic simulation.

class Behavior(*args, **kwargs)[source]

Bases: scenic.core.dynamics.Invocable, scenic.core.distributions.Samplable

Dynamic behaviors of agents.

Behavior statements are translated into definitions of subclasses of this class.

class Monitor(*args, **kwargs)[source]

Bases: scenic.core.dynamics.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 or InvariantViolation will be used, as appropriate.

exception PreconditionViolation(behavior, lineno)[source]

Bases: scenic.core.dynamics.GuardViolation

Raised when a precondition is violated when invoking a behavior.

exception InvariantViolation(behavior, lineno)[source]

Bases: scenic.core.dynamics.GuardViolation

Raised when an invariant is violated when invoking/resuming a behavior.

class BlockConclusion(value)[source]

Bases: enum.Enum

An enumeration.