RunProtelisProgram

An it.unibo.alchemist.model.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: NodeReaction<Any>, program: ProtelisProgram, retentionTime: Double = Double.NaN)
constructor(randomGenerator: RandomGenerator, environment: Environment<Any, P>, device: ProtelisDevice<P>, reaction: NodeReaction<Any>, program: ProtelisProgram, retentionTime: Double = Double.NaN, packetLossDistributionName: String, vararg packetLossDistributionParameters: Double)
constructor(randomGenerator: RandomGenerator, environment: Environment<Any, P>, device: ProtelisDevice<P>, reaction: NodeReaction<Any>, program: String, retentionTime: Double = Double.NaN)
constructor(randomGenerator: RandomGenerator, environment: Environment<Any, P>, device: ProtelisDevice<P>, reaction: NodeReaction<Any>, program: String, retentionTime: Double = Double.NaN, packetLossDistributionName: String, vararg packetLossDistributionParameters: Double)

Properties

Link copied to clipboard

An observable that emits updates indicating whether the computational cycle of a Protelis program has been completed.

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

Provides an access to the underlying org.protelis.vm.ExecutionContext.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val program: ProtelisProgram
Link copied to clipboard
Link copied to clipboard
override val reaction: NodeReaction<Any>

The NodeReaction owning this action, hosted by targetNode.

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
Link copied to clipboard
override fun cloneAction(newReaction: Reaction<Any>): Action<Any>

Creates an equivalent action owned by newReaction, such as a reaction cloned onto a new node. An action targeting the host of its reaction targets the host of newReaction, which must then be a Node; an action targeting any other node keeps its target.

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

Applies this action to the model.

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

Marks the computational cycle as incomplete before the next run.

Link copied to clipboard
infix fun Action<*>.shouldEqual(other: Action<*>)
Link copied to clipboard
open override fun toString(): String