Bases: mlpy.modules.Module

The world model.

The world model manages the world objects of type WorldObject by ensuring that the objects are updated with the latest information at every time step of the program loop. Furthermore, information of the world objects can be accessed from the world model.


The world module follows the singleton design pattern (Singleton), ensuring only one instances of the world module exist. This allows for accessing the information of the world model from anywhere in the program.


>>> from import WorldModel, WorldObject
>>> WorldModel().add_object("ball", WorldObject)
>>> from import WorldModel
>>> ball = WorldModel().get_object("ball")


mid The module’s unique identifier.


add_object(name, obj) Add a world object.
enter(t) Enter the world model.
exit() Exit the module and perform cleanup tasks.
get_object(name) Returns the object with the given name.
load(filename) Load the state of the module from file.
reset(t, **kwargs) Reset the module.
save(filename) Save the current state of the module to file.
update(dt) Update all world objects.