RunProtelisProgram

An Action that executes a Protelis program.

Requires the current randomGenerator and environment, a valid ProtelisDevice (device), and the local reaction hosting the computation.

The program can be created using a String (originalProgram), or, alternatively, by providing a ProtelisProgram (program).

retentionTime specifies whether, upon message usage, the received messages should be deleted (assuming a reasonable synchronization among devices) or if they should remain in memory for a specified amount of time. By default, retentionTime is Double.NaN, indicating that messages are deleted upon read.

It is possible to simulate the loss of messages due to a higher connection distance by providing a RealDistribution (packetLossDistance) mapping distances to the loss probability. By default, this feature is disabled.

Constructors

Link copied to clipboard
constructor(randomGenerator: RandomGenerator, environment: Environment<Any, P>, device: ProtelisDevice<P>, reaction: Reaction<Any>, program: ProtelisProgram, retentionTime: Double = Double.NaN)
constructor(randomGenerator: RandomGenerator, environment: Environment<Any, P>, device: ProtelisDevice<P>, reaction: Reaction<Any>, program: ProtelisProgram, retentionTime: Double = Double.NaN, packetLossDistributionName: String, vararg packetLossDistributionParameters: Double)
constructor(randomGenerator: RandomGenerator, environment: Environment<Any, P>, device: ProtelisDevice<P>, reaction: Reaction<Any>, program: String, retentionTime: Double = Double.NaN)
constructor(randomGenerator: RandomGenerator, environment: Environment<Any, P>, device: ProtelisDevice<P>, reaction: Reaction<Any>, program: String, retentionTime: Double = Double.NaN, packetLossDistributionName: String, vararg packetLossDistributionParameters: Double)

Properties

Link copied to clipboard
open override val context: Context
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val node: Node<Any>

The Alchemist Node hosting the ProtelisDevice.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
Link copied to clipboard
open override fun cloneAction(node: Node<Any>, reaction: Reaction<Any>): RunProtelisProgram<P>

This method allows to clone this action on a new node. It may result useful to support runtime creation of nodes with the same reaction programming, e.g. for morphogenesis.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun execute()

Effectively executes this action.

Link copied to clipboard
open override fun getContext(): Context
Link copied to clipboard
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard

Resets the computation status (used for dependency management).

Link copied to clipboard
open override fun toString(): String