Skip to content

GAMMS Context


Bases: ABC

Abstract base class representing the overall context of the system.

The IContext interface serves as a central point of access to various engine components within the system, including sensors, visualization, agents, and graph management. It provides properties to retrieve instances of these engines, facilitating coordinated interactions and data flow between different system parts.

agent abstractmethod property

Retrieve the agent engine.

The agent engine manages the lifecycle and behavior of agents within the system. It handles agent creation, state management, and interaction with other system components.

Returns:

Name Type Description
IAgentEngine IAgentEngine

An instance of the agent engine.

Raises:

Type Description
RuntimeError

If the agent engine is not properly initialized.

graph abstractmethod property

Retrieve the graph engine.

The graph engine manages the underlying graph structure, including nodes and edges. It provides functionalities to modify the graph, retrieve graph elements, and maintain graph integrity.

Returns:

Name Type Description
IGraphEngine IGraphEngine

An instance of the graph engine.

Raises:

Type Description
RuntimeError

If the graph engine is not properly initialized.

ictx abstractmethod property

Retrieve the internal context of the system.

The internal context encapsulates core configurations, state information, and shared resources necessary for the operation of various system components.

Returns:

Name Type Description
IInternalContext IInternalContext

An instance representing the internal context.

Raises:

Type Description
RuntimeError

If the internal context is not properly initialized.

logger abstractmethod property

Retrieve the logger.

The logger is responsible for logging messages and events within the system. It provides various logging levels (debug, info, warning, error, critical) for structured logging.

Returns:

Name Type Description
ILogger ILogger

An instance of the logger engine.

Raises:

Type Description
RuntimeError

If the logger engine is not properly initialized.

record abstractmethod property

Retrieve the recorder.

The recorder is responsible for recording and replaying system events. It captures information about system states and interactions for analysis and debugging purposes.

Returns:

Name Type Description
IRecorder IRecorder

An instance of the recorder engine.

Raises:

Type Description
RuntimeError

If the recorder engine is not properly initialized.

sensor abstractmethod property

Retrieve the sensor engine.

The sensor engine manages all sensor-related operations, including the creation, updating, and retrieval of sensors. It facilitates data collection from various sources within the system.

Returns:

Name Type Description
ISensorEngine ISensorEngine

An instance of the sensor engine.

Raises:

Type Description
RuntimeError

If the sensor engine is not properly initialized.

visual abstractmethod property

Retrieve the visualization engine.

The visualization engine handles the rendering and display of the system's graphical elements, such as graphs and agents. It manages visual configurations and updates the visualization based on simulation states.

Returns:

Name Type Description
IVisualizationEngine IVisualizationEngine

An instance of the visualization engine.

Raises:

Type Description
RuntimeError

If the visualization engine is not properly initialized.

is_terminated() abstractmethod

Check if the context is terminated.

This method determines whether the context has been terminated, indicating that no further operations should be performed.

Returns:

Name Type Description
bool bool

True if the context is terminated, False otherwise.

terminate() abstractmethod

Terminate the context.

This method performs necessary cleanup operations and releases resources associated with the context. It should be called when the context is no longer needed.

Raises:

Type Description
RuntimeError

If the termination process encounters an error.