Class MultiSourceSPParticle
Implements the (k, l)-SPF algorithm.
Inheritance
object
MultiSourceSPParticle
Assembly: .dll
Syntax
public class MultiSourceSPParticle : ParticleAlgorithm
Constructors
|
Edit this page
View Source
MultiSourceSPParticle(Particle)
Declaration
public MultiSourceSPParticle(Particle p)
Parameters
Fields
|
Edit this page
View Source
augPortalColor
Declaration
private static readonly Color augPortalColor
Field Value
|
Edit this page
View Source
baseColor
Declaration
private static readonly Color baseColor
Field Value
|
Edit this page
View Source
counter
Declaration
private ParticleAttribute<int> counter
Field Value
|
Edit this page
View Source
counter2
Declaration
private ParticleAttribute<int> counter2
Field Value
|
Edit this page
View Source
destColor
Declaration
private static readonly Color destColor
Field Value
|
Edit this page
View Source
doFinalPrune
Declaration
private ParticleAttribute<bool> doFinalPrune
Field Value
|
Edit this page
View Source
ett
Declaration
Field Value
|
Edit this page
View Source
inMPrime
Declaration
private ParticleAttribute<bool> inMPrime
Field Value
|
Edit this page
View Source
instances
Declaration
private MultiSourceSPParticle.Instance[] instances
Field Value
|
Edit this page
View Source
isDest
Declaration
private ParticleAttribute<bool> isDest
Field Value
|
Edit this page
View Source
isLeader
Declaration
private ParticleAttribute<bool> isLeader
Field Value
|
Edit this page
View Source
isSelectedCentroid
Declaration
private ParticleAttribute<bool> isSelectedCentroid
Field Value
|
Edit this page
View Source
isSource
Declaration
private ParticleAttribute<bool> isSource
Field Value
|
Edit this page
View Source
lastCentroid
Declaration
private ParticleAttribute<bool> lastCentroid
Field Value
|
Edit this page
View Source
leaderColor
Declaration
private static readonly Color leaderColor
Field Value
|
Edit this page
View Source
leftWinsMerge
Declaration
private ParticleAttribute<bool> leftWinsMerge
Field Value
|
Edit this page
View Source
mainDir
Declaration
private const Direction mainDir = E
Field Value
|
Edit this page
View Source
marker1
Declaration
private ParticleAttribute<bool> marker1
Field Value
|
Edit this page
View Source
marker2
Declaration
private ParticleAttribute<bool> marker2
Field Value
|
Edit this page
View Source
markerColor
Declaration
private static readonly Color markerColor
Field Value
|
Edit this page
View Source
numInstances
Declaration
private ParticleAttribute<int> numInstances
Field Value
|
Edit this page
View Source
pasc
Declaration
Field Value
|
Edit this page
View Source
pascParticipant
Declaration
private ParticleAttribute<bool> pascParticipant
Field Value
|
Edit this page
View Source
phase
Declaration
private ParticleAttribute<MultiSourceSPParticle.Phase> phase
Field Value
|
Edit this page
View Source
pruned
Declaration
private ParticleAttribute<bool> pruned
Field Value
|
Edit this page
View Source
regionColor
Declaration
private ParticleAttribute<bool> regionColor
Field Value
|
Edit this page
View Source
rootPortal
Declaration
private ParticleAttribute<bool> rootPortal
Field Value
|
Edit this page
View Source
round
Declaration
private ParticleAttribute<int> round
Field Value
|
Edit this page
View Source
skipMerge
Declaration
private ParticleAttribute<bool> skipMerge
Field Value
|
Edit this page
View Source
sourceColor
Declaration
private static readonly Color sourceColor
Field Value
|
Edit this page
View Source
sourcePortal
Declaration
private ParticleAttribute<bool> sourcePortal
Field Value
|
Edit this page
View Source
sourcePortalColor
Declaration
private static readonly Color sourcePortalColor
Field Value
|
Edit this page
View Source
subDecomposition
Declaration
private SubDecomposition subDecomposition
Field Value
|
Edit this page
View Source
subPhase
Declaration
private ParticleAttribute<MultiSourceSPParticle.SubPhase> subPhase
Field Value
|
Edit this page
View Source
subSPFLine
Declaration
private SubSPFLine subSPFLine
Field Value
Properties
|
Edit this page
View Source
GenerationMethod
Declaration
public static string GenerationMethod { get; }
Property Value
|
Edit this page
View Source
Name
Declaration
public static string Name { get; }
Property Value
|
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
Overrides
Methods
|
Edit this page
View Source
ActivateBaseCase()
Declaration
private void ActivateBaseCase()
|
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
|
Edit this page
View Source
ActivateFinalPrune()
Declaration
private void ActivateFinalPrune()
|
Edit this page
View Source
ActivateMergingStep()
Declaration
private void ActivateMergingStep()
|
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
|
Edit this page
View Source
ActivateSetupPhase()
Declaration
private void ActivateSetupPhase()
|
Edit this page
View Source
Active()
Returns a list of indices of all instances that are active based on region color for merging.
Declaration
private List<int> Active()
Returns
| Type |
Description |
| List<int> |
|
|
Edit this page
View Source
ActiveInstances()
Returns a list of indices of all instances that are active based on region color.
Declaration
private List<int> ActiveInstances()
Returns
| Type |
Description |
| List<int> |
|
|
Edit this page
View Source
AddIgnoreDirs(List<Direction>, int)
Declaration
private void AddIgnoreDirs(List<Direction> ignoreDirs, int i)
Parameters
| Type |
Name |
Description |
| List<Direction> |
ignoreDirs |
|
| int |
i |
|
|
Edit this page
View Source
AdvanceEnum<T>(ParticleAttribute<T>)
Advances the given enum attribute to the next value. If it is already at the last value, it remains unchanged.
Declaration
private static void AdvanceEnum<T>(ParticleAttribute<T> attr) where T : struct, Enum
Parameters
Type Parameters
|
Edit this page
View Source
Init(bool, bool, bool)
Declaration
public void Init(bool isLeader = false, bool isSource = false, bool isDest = false)
Parameters
| Type |
Name |
Description |
| bool |
isLeader |
|
| bool |
isSource |
|
| bool |
isDest |
|
|
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
|
Edit this page
View Source
IsMarker()
Declaration
Returns
|
Edit this page
View Source
IsOnQPrime()
Checks whether or not this amoebot's portal is in Q'.
Declaration
private bool IsOnQPrime()
Returns
| Type |
Description |
| bool |
true if and only if this amoebot's portal contains
a source or is an augmentation portal.
|
|
Edit this page
View Source
IsOnQPrime2()
Declaration
private bool IsOnQPrime2()
Returns
|
Edit this page
View Source
Next()
helper function for advancing to next subphase and resetting counters
Declaration
|
Edit this page
View Source
RunColoring(SubPhase, bool)
Declaration
private void RunColoring(MultiSourceSPParticle.SubPhase nextPhase = SubPhase.NONE, bool reset = false)
Parameters
|
Edit this page
View Source
RunDecompositionAlgorithm(SubPhase)
Declaration
private void RunDecompositionAlgorithm(MultiSourceSPParticle.SubPhase nextSubPhase = SubPhase.NONE)
Parameters
|
Edit this page
View Source
RunLineAlgorithm()
Declaration
private void RunLineAlgorithm()
|
Edit this page
View Source
RunMPrimeSearch()
Declaration
private void RunMPrimeSearch()
|
Edit this page
View Source
RunMSMergingAlgorithm()
Declaration
private void RunMSMergingAlgorithm()
|
Edit this page
View Source
RunMSMergingAlgorithm2()
Declaration
private void RunMSMergingAlgorithm2()
|
Edit this page
View Source
RunMSPropAlgorithm()
Declaration
private void RunMSPropAlgorithm()
|
Edit this page
View Source
RunMergingAlgorithm()
Declaration
private void RunMergingAlgorithm()
|
Edit this page
View Source
RunPropAlgorithm()
Declaration
private void RunPropAlgorithm()
|
Edit this page
View Source
RunPropPreparation()
Declaration
private void RunPropPreparation()
|
Edit this page
View Source
RunSSSPAlgorithm()
Declaration
private void RunSSSPAlgorithm()
|
Edit this page
View Source
RunSetup()
Declaration
|
Edit this page
View Source
SetColor()
Sets the color of this amoebot according to its
current phase and state.
Declaration
|
Edit this page
View Source
SetupGlobalCircuit(int)
Sets up a global circuit connecting all amoebots on the partition set with the given Id.
Declaration
private void SetupGlobalCircuit(int partitionSetId = 0)
Parameters
| Type |
Name |
Description |
| int |
partitionSetId |
The partition set id for the circuit
|
|
Edit this page
View Source
SetupGlobalCircuit(int, int)
Declaration
private void SetupGlobalCircuit(int pSet, int offset)
Parameters
| Type |
Name |
Description |
| int |
pSet |
|
| int |
offset |
|
|
Edit this page
View Source
SetupRegionCircuits(PinConfiguration, Direction, bool)
Sets up two circuits for each region. The partition set IDs
will be 2i and 2i + 1 for instance i.
Declaration
private void SetupRegionCircuits(PinConfiguration pc, Direction portalDir, bool connectMarker = false)
Parameters
| Type |
Name |
Description |
| PinConfiguration |
pc |
The pin configuration to modify.
|
| Direction |
portalDir |
The direction of the portal axis.
|
| bool |
connectMarker |
Whether to connect the two sides of a marker.
|
|
Edit this page
View Source
SetupSingletonCircuit()
Sets up a singleton circuit on all amoebots.
Declaration
private void SetupSingletonCircuit()
|
Edit this page
View Source
ShowParentTree(ParticleSystem, Particle)
Declaration
[StatusInfo("Show Parent Edge", "Draws the parent edge of all amoebots with respect to the region's primary portal as soon as they are available.", false)]
public static void ShowParentTree(ParticleSystem system, Particle selectedParticle)
Parameters
|
Edit this page
View Source
ShowTree(ParticleSystem, Particle)
Declaration
[StatusInfo("Show Parent Edges", "Draws the parent edges of all amoebots as soon as they are available. Blue edges are with respect to the region's primary portal, red edges with respect to the secondary portal.", false)]
public static void ShowTree(ParticleSystem system, Particle selectedParticle)
Parameters