Search Results for

    Show / Hide Table of Contents

    Class LeaderElectionParticle

    Implementation of the leader election algorithm presented in https://arxiv.org/abs/2105.05071v1. Chirality and compass direction can be arbitrary.

    In the first phase, the algorithm alternates between rounds 0 and 1 in each iteration. In round 0, particles toss coins and beep if they have tossed HEADS, and in round 1, they listen for the beep from round 0 and beep if they have tossed TAILS. In the next round 0, they listen for these beeps and decide whether to repeat the process or initiate phase 2.

    The second phase works analogously but with 4 rounds 0-3 instead of 2 rounds per iteration.

    Inheritance
    object
    ParticleAlgorithm
    LeaderElectionParticle
    Namespace: AS2.Algos.LeaderElection
    Assembly: .dll
    Syntax
    public class LeaderElectionParticle : ParticleAlgorithm

    Constructors

    | Edit this page View Source

    LeaderElectionParticle(Particle)

    Declaration
    public LeaderElectionParticle(Particle p)
    Parameters
    Type Name Description
    Particle p

    Fields

    | Edit this page View Source

    beepFromHeads

    Declaration
    private ParticleAttribute<bool> beepFromHeads
    Field Value
    Type Description
    ParticleAttribute<bool>
    | Edit this page View Source

    firstActivation

    Declaration
    private ParticleAttribute<bool> firstActivation
    Field Value
    Type Description
    ParticleAttribute<bool>
    | Edit this page View Source

    firstPhase

    Declaration
    private ParticleAttribute<bool> firstPhase
    Field Value
    Type Description
    ParticleAttribute<bool>
    | Edit this page View Source

    heads

    Declaration
    private ParticleAttribute<bool> heads
    Field Value
    Type Description
    ParticleAttribute<bool>
    | Edit this page View Source

    isCandidate

    Declaration
    private ParticleAttribute<bool> isCandidate
    Field Value
    Type Description
    ParticleAttribute<bool>
    | Edit this page View Source

    kappa

    Declaration
    private static readonly int kappa
    Field Value
    Type Description
    int
    | Edit this page View Source

    phase2Candidate

    Declaration
    private ParticleAttribute<bool> phase2Candidate
    Field Value
    Type Description
    ParticleAttribute<bool>
    | Edit this page View Source

    phase2Count

    Declaration
    private ParticleAttribute<int> phase2Count
    Field Value
    Type Description
    ParticleAttribute<int>
    | Edit this page View Source

    round

    Declaration
    private ParticleAttribute<int> round
    Field Value
    Type Description
    ParticleAttribute<int>
    | Edit this page View Source

    terminated

    Declaration
    private ParticleAttribute<bool> terminated
    Field Value
    Type Description
    ParticleAttribute<bool>

    Properties

    | Edit this page View Source

    GenerationMethod

    Declaration
    public static string GenerationMethod { get; }
    Property Value
    Type Description
    string
    | Edit this page View Source

    Name

    Declaration
    public static string Name { get; }
    Property Value
    Type Description
    string
    | Edit this page View Source

    PinsPerEdge

    The number of pins on each edge.

    This number must be the same constant for all particles.

    Declaration
    public override int PinsPerEdge { get; }
    Property Value
    Type Description
    int
    Overrides
    ParticleAlgorithm.PinsPerEdge

    Methods

    | Edit this page View Source

    ActivateBeep()

    This is the second part of the main activation logic of the particle. It is called exactly once in each round, after the movements scheduled in ActivateMove() have been executed, and should contain the algorithm code that implements the look-compute-beep cycle.

    Inside of this method, particles are allowed to change their pin configuration and send beeps and messages on the updated configuration.

    Note that beeps and messages sent in the current round will be readable in both the ActivateMove() and ActivateBeep() calls in the next round.

    Declaration
    public override void ActivateBeep()
    Overrides
    ParticleAlgorithm.ActivateBeep()
    | Edit this page View Source

    ActivateMove()

    This is one part of the main activation logic of the particle. It is called exactly once in each round and should contain the algorithm code that implements the look-compute-move cycle. After the movements are executed, ActivateBeep() is called within the same round.

    Inside of this method, particles are allowed to release bonds, define which bonds should be marked, and schedule movements. Only the last movement operation scheduled in this method will be applied.

    Declaration
    public override void ActivateMove()
    Overrides
    ParticleAlgorithm.ActivateMove()
    | Edit this page View Source

    IsFinished()

    Checks whether this particle has finished its algorithm.

    Override this method to return true when a particle is done executing the algorithm. Once all particles in the system are finished, the simulation will stop automatically. When a particle's state results in this method returning true, its activation methods should not change its state any more.

    Declaration
    public override bool IsFinished()
    Returns
    Type Description
    bool

    true if and only if this particle has finished its algorithm.

    Overrides
    ParticleAlgorithm.IsFinished()
    | Edit this page View Source

    SendBeep()

    Declaration
    private void SendBeep()
    | Edit this page View Source

    TossCoin()

    Declaration
    private bool TossCoin()
    Returns
    Type Description
    bool
    • Edit this page
    • View Source
    In this article
    Back to top AmoebotSim 2.0 Documentation v1.11
    Copyright © 2025 AmoebotSim 2.0 Authors
    Generated by DocFX