API Reference

RxEnvironments.AbstractEntityType
AbstractEntity{T}

The AbstractEntity type supertypes all entities. It describes basic functionality all entities should have. It is assumed that every entity has a markov blanket, which has actuators and sensors. The AbstractEntity also has a field that describes whether or not the entity is terminated.

source
RxEnvironments.RxEntityType
RxEntity

The RxEntity is the vanilla implementation of an AbstractEntity that is used in most cases. It is a wrapper around an entity that adds the following functionality:

  • A MarkovBlanket that contains the actuators and sensors of the entity
  • A EntityProperties that contains the state space, whether or not the entity is active, and the real time factor
  • A EntityActor that handles the logic for receiving observations and sending actions
source
Rocket.on_next!Method
Rocket.on_next!(actor::EntityActor{ActiveEntity}, observation)})

Handles the logic for an incoming observation for an active entity. This means that the entity will update its state, incorporate the observation into its state, and then send an action to all of its subscribers. The action is determined by the what_to_send function. Emissions can be filtered by implementing the emits function.

This function is automatically called whenever the entity receives an observation on it's sensor. The observation will contain the data sent by the emitter as well as a reference to the emitter itself.

source
Rocket.on_next!Method
Rocket.on_next!(actor::EntityActor{PassiveEntity}, observation)

Handles the logic for an incoming observation for a passive entity. This means that we will only incorporate the observation into the entity's state.

source
Rocket.unsubscribe!Method

Unsubscribes receiver from emitter. Any data sent from emitter to receiver will not be received by receiver after this function is called.

source
RxEnvironments.__send!Method
__send!(recipient::AbstractEntity, emitter::AbstractEntity, action::Any)

Send an action from emitter to recipient.

source
RxEnvironments.action_typeMethod
action_type(::T)

Returns the default action type for an entity of type T. By default, this function returns Any. This is used to determine the type of actions that can be sent to an entity. Although this restricts the type of actions that can be sent to an entity, it allows for more type-stable code.

source
RxEnvironments.add!Method
add!(first::AbstractEntity{T,S,E}, second; environment=false) where {T,S,E}

Adds second to first. If environment is true, the AbstractEntity created for second will be labeled as an environment. The Markov Blankets for both entities will be subscribed to each other.

Arguments

  • first::AbstractEntity{T,S,E}: The entity to which second will be added.
  • second: The entity to be added to first.
  • is_active=false: A boolean indicating whether second should be instantiated as an active entity.
source
RxEnvironments.create_entityMethod
create_entity(entity; is_discrete = false, is_active = false, real_time_factor = 1)

Creates an RxEntity that decorates a given entity. The is_discrete and is_active parameters determine whether or not the entity lives in a discrete or continuous state-space, and whether or not the entity is active or passive. The real_time_factor parameter determines how fast the entity's clock ticks. This function can be used as a lower-level API in order to create a more complex network of entities.

source
RxEnvironments.emitsMethod
emits(subject, listener, observation)

Determines if an entity of the type of subject should emit an observation to an entity of the type of listener when presented with an obervation of type observation. Users should implement this function for their own entity and observation types to handle the logic of when to emit observations to which entities. By default, this function returns true.

source
RxEnvironments.is_subscribedMethod
is_subscribed(subject::AbstractEntity, target::AbstractEntity)

Check if subject is subscribed to target.

Arguments

  • subject::AbstractEntity: The entity that may be subscribed to target.
  • target::AbstractEntity: The entity that may be subscribed to by subject.

Returns

true if subject is subscribed to target, false otherwise.

source
RxEnvironments.send!Method
send!(recipient::AbstractEntity, emitter::AbstractEntity, action::Any)

Send an action from emitter to recipient.

source
RxEnvironments.subscribe_to_observations!Method
subscribe_to_observations!(entity::AbstractEntity, actor)

Subscribe actor to the observations of entity. Any data sent to entity will be received by actor after this function is called.

source
RxEnvironments.terminate!Method
terminate!(entity::AbstractEntity)

Terminate an entity by setting its is_terminated flag to true and severing off all subscriptions to and from the entity.

Arguments

  • entity::AbstractEntity: The entity to terminate.
source
RxEnvironments.time_intervalMethod
time_interval(::T)

Returns the default time interval for an entity of type T. By default, this function returns 1. This is used in discrete active entities to determine the elapsed time between state updates. Through dispatching, we can define different time intervals for different entity types.

source
RxEnvironments.update!Method
update!(e::AbstractEntity{T,ContinuousEntity,E}) where {T,E}

Update the state of the entity e based on its current state and the time elapsed since the last update. Acts as state transition function.

Arguments

  • e::AbstractEntity{T,ContinuousEntity,E}: The entity to update.
source