RunProtelisProgram

class RunProtelisProgram<P : Position<P>> : Action<Any>

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 sumulate 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
fun <P : Position<P>> RunProtelisProgram(    randomGenerator: RandomGenerator,     environment: Environment<Any, P>,     device: ProtelisDevice<P>,     reaction: Reaction<Any>,     program: ProtelisProgram,     retentionTime: Double = Double.NaN)
Link copied to clipboard
fun <P : Position<P>> RunProtelisProgram(    randomGenerator: RandomGenerator,     environment: Environment<Any, P>,     device: ProtelisDevice<P>,     reaction: Reaction<Any>,     program: ProtelisProgram,     retentionTime: Double = Double.NaN,     packetLossDistributionName: String,     vararg packetLossDistributionParameters: Double)
Link copied to clipboard
fun <P : Position<P>> RunProtelisProgram(    randomGenerator: RandomGenerator,     environment: Environment<Any, P>,     device: ProtelisDevice<P>,     reaction: Reaction<Any>,     program: String,     retentionTime: Double = Double.NaN)
Link copied to clipboard
fun <P : Position<P>> RunProtelisProgram(    randomGenerator: RandomGenerator,     environment: Environment<Any, P>,     device: ProtelisDevice<P>,     reaction: Reaction<Any>,     program: String,     retentionTime: Double = Double.NaN,     packetLossDistributionName: String,     vararg packetLossDistributionParameters: Double)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun asMolecule(): Molecule
Link copied to clipboard
open override fun cloneAction(node: Node<Any>, reaction: Reaction<Any>): RunProtelisProgram<P>
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun execute()
Link copied to clipboard
open override fun getContext(): Context
Link copied to clipboard
open override fun getOutboundDependencies(): ImmutableListSet<Dependency>
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
fun prepareForComputationalCycle()

Resets the computation status (used for dependency management).

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

Properties

Link copied to clipboard
val device: ProtelisDevice<P>
Link copied to clipboard
val environment: Environment<Any, P>
Link copied to clipboard
var executionContext: AlchemistExecutionContext<P>

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

Link copied to clipboard
var isComputationalCycleComplete: Boolean = false
Link copied to clipboard
val node: Node<Any>

The Alchemist Node hosting the ProtelisDevice.

Link copied to clipboard
val originalProgram: String
Link copied to clipboard
val packetLossDistance: RealDistribution?
Link copied to clipboard
val program: ProtelisProgram
Link copied to clipboard
val randomGenerator: RandomGenerator
Link copied to clipboard
val reaction: Reaction<Any>
Link copied to clipboard
val retentionTime: Double