Title: Chapter 9 Cellular Spaces
1Chapter 9 Cellular Spaces
- One Dimensional Cell Spaces
- Example Pulse Pipeline
- Example Sieve of Eratosthenes
- Example Pascal Triangle
- Cellular Automata
- Two Dimensional Cell Spaces
- Connecting Agents to Cell Spaces
- Example Sensing Light Spread To Avoid Obstacles
2Some Types of Models Represented in DEVS
Coupled Models
Atomic Models
Partial Differential Equations
can be components in a coupled model
Ordinary Differential Equation Models
Processing/ Queuing/ Coordinating
Networks, Collaborations
Physical Space
Spiking Neuron Networks
Spiking Neuron Models
Processing Networks
Petri Net Models
n-Dim Cell Space
Discrete Time/ StateChart Models
Stochastic Models
Cellular Automata
Quantized Integrator Models
Self Organized Criticality Models
Fuzzy Logic Models
Reactive Agent Models
Multi Agent Systems
3One Dimensional DEVS Cellular Space Classes
A one dimensional cellular space is a sequence of
cells each which is an instance of the same devs
class. The coupling involves nearest neighbors
and is uniform, i.e., the same at every cell.
ViewableDigraph
OneDimCell inherits from Viewable Atomic to
provide cells that are atomic in nature
ViewableAtomic
oneDimCellSpace
extends ViewableDigraph public void
doNeighborCoupling()... public void
addCell()... public void addPlots()...
ltoneDCellgt public int getId() public void
addNeighbor(int i,oneDCell n) public void
addNeighborCoupling(int i,String outpt,String
inpt) public void setDrawPos(int
i) public static int numCells 10
oneDimCell protected int id 0 protected rand
r protected int d rawPos
,numTransitions
1n
OneDimCellSpace. oneDimCellSpace
OneDimCellSpace. oneDimCell
Interface oneDCell specifies the minimal
requirements needed for both cell space and
graphics behaviors
OneDimCellSpace provides methods for adding cells
and displaying graphics of all cells.
4Example Pulse Pipeline One Dimensional Cell Space
pulseCell extends oneDimCell and implements
similar behavior to fireOnceNeuron
experimental frame feeds pulses to the first cell
and counts the number that make it to the last
cell
class pulseCell extends oneDimCell protected
double fireDelay public pulseCell( int id,
double fireDelay ) super( id, null ) ...
public void deltext( double e, message x ) ...as
in fireOnceNeuron public message out()...
outRealValueOnPort(2.0, "out") return m
OneDimCellSpace. pipeLineRand
class pulsePipe extends oneDimCellSpace
public pulsePipe( int numCells, double fireDelay
) super( "pulsePipe" ) this.numCells
numCells for ( int i 0 iltnumCells i )
pulseCell tmp new pulseCell(i,
fireDelay) addCell( i, tmp ) if ( i
0 ) addCoupling( this, "in", tmp, "in" )
if ( i numCells -1 ) addCoupling( tmp, "out",
this, "out" ) hideAll()
doNeighborCoupling( 1, "out", "in" )
pulsePipe extends oneDimCellSpace and sets up
coupling from a cell to its right neighbor
5Pileline Delays and Throughput
- Modify the fireOnceNeuron so that its fireDelay
is the mean of an exponential distribution for
the actual firing delay. In other words,
following the example of genrRand (in Simparc and
also on a slide) sample the firingDelay from an
exponential distribution with fireDelay as mean.
Make the initial seed a parameter so that you can
set it. - Following the example of workerCellSpace or
earthquakeCellSpace, place neurons in a one
dimensional cell space with a left-to-right
pipeline coupling (output to input). Let the
number of neurons N be a parameter of the model. - Develop an experimental frame that measures the
time it takes for a pulse to traverse the space
from left to right, after which it feeds another
pulse to the pipeline and measures the traversal
time again now with a different seed, and so on. - For the case N 4, do 10 traversals. Use the
same fireDelay parameter value for each neuron.
Estimate the mean as the average time of the 10
traversals. - Based on the case N4, Investigate the
relationship between the average traversal time
and the number of neurons in the pipeline. - For any N, generate pulses with rate, r(N)
N/fireDelay and feed them to a pipeline with N
neurons so that the average traversal time equals
fireDelay. Find the N which maximizes the
throughput r(N) the ratio of pulses that
reached final output to those generated). Try
distributions for fireDelay, other than the
exponential, to see how they change the optimum
number of neurons.
6Sieve of Eratosthenes unbounded signal speeds
in DEVS Cell Space
3
4
5
2
6
8
9
10
Model building asks these kinds of questions
Develop a oneDim Cell Space model that implements
the prime number sieve. Each cell has only its
left cell as influencer neighbor Start with an
initial state of cells with numbers from 2 to N.
A cell with integer n other than 2 is initially
passive in phase Temp Cell 2 is initially
active in phase Prime An active cell starts a
signal with its value moving to the right at a
speed inverse to its value. When a signal reaches
a cell, the cell passes it on with a delay
matching the speed of the input signal. If the
cell contents is a multiple of the input, it
passivates in phase composite after passing on
the signal. If the input is the contents of its
left neighbor it becomes active, propagating its
value to the right. At this point it marks
itself as Prime.
global constraints move signals to the right in
order of size efficiency restricting messages to
those from primes will reduce traffic at cost of
cell complexity special cases 2,3 (2 is the
only prime neighbor of another prime)
http//www.math.utah.edu/
alfeld/Eratosthenes.html
7Prime Sieve (contd)
cell n
outPrime
inPrime
deltext continue(e) if (input on inPrime from
left neighbor evenly divides you) then
holdIn(Composite,input) else holdIn(temp, input)
n-1
n
out
in
to distinguish primes from others send on
dedicated port
outPrime n
prime
deltint if (phaseIs(temp and input n-1))
holdIn(outPrime, n) if (phaseIs(Composite) and
input n-1) holdIn(lastComposite, n)
outPrime
in n-1
lastComposite
temp
inPrime x and x divides n
in n-1
if (phaseIs(outPrime)) output n on
outPrime else if (phaseIs(lastComposite)) output
n on out else output input on out
out n
Composite
outPrime x
OneDimCellSpace. pascalCellSpace
8Cellular Space Realization of Pascals Triangle
- Implementation
- A one-dimensional cell space with left to
- right neighborhood such that each cell adds its
neighbors - state to its own at each time step.
- The exceptions are the initial passive cells o
the right of the 2. - They are activated as the non-unity activity
reaches them. - Row counts are incremented at each step for
active cells - Their states are plotted at points (cell index,
cell row) using - parity coding (modulo 2).
- The resulting pattern turns the triangle on its
side.
parity mapping
2
1
1
1
1
1
1
1
3
3
1
1
1
1
1
1
4
6
4
1
1
1
1
1
OneDimCellSpace. pascalCellSpace
log plot of cell states
Game, set, and math enigmas and conundrums /
Ian Stewart.Oxford England Cambridge, Mass,
USA B. Blackwell, 1989. http//www.cs.washingto
n.edu/homes/jbaer/classes/blaise/blaise.html
9Cellular Automata
Cellular Automata are oneDimentional cellular
spaces in which the time base is discrete and all
cells execute their state transition functions
simultaneously at each time step. Cells get
information from neighboring cells as defined by
neighborhood. For example, for Wolframs rule 30
for 1D CAs, the neighborhood consists of the
cells to the left and right of a center. With
each cell having two states, the transition
function must therefore specify the next state of
the center cell for each of the eight state
configurations, as in 111-gt0, 110-gt0,
101-gt0, 100-gt1, 011-gt1, 010-gt1, 001-gt1, 000-gt0
When applied to an initial state of a single 1
surrounded by 0's, rule 30 generates the
following pattern (developing downward from the
top row). The array can be displayed as a
pattern of black and white pixels, as below,
producing a visualization of the evolving state
of the horizontal rows. ..00000000100000000.. ..
00000001110000000....00000011001000000....000001
10111100000....00001100100010000....000110111101
11000....00110010000100100....01101111001111110.
. 1. www.amazon.com review of A New Kind of
Science by S. Wolfram.
10 Forest Fire Two Dimensional Space
Cell Space
Neighborhood
Ignite
N
NE
NW
Wind
W
E
Water
SE
SW
S
out from South -gt in to North
Coupling based on Neighborhood
outS
inS
inN
outN
11Two Dimensional DEVS Cellular Space Classes
A two dimensional cellular space is an array of
cells each which is an instance of the same devs
class. The coupling involves nearest neighbors
and is uniform, i.e., the same at every cell.
TwoDimCell inherits from Viewable Atomic
implements Cell
Interface Cell specifies the minimal requirements
needed for both cell space and graphics behaviors
can be implemented by a modelers digraph class
ViewableDigraph
ViewableAtomic
TwoDimCellSpace public void
addCell()... public void doNeighborToNeighborCou
pling()... public Cell withId(int xcoord, int
ycoord) public Cell neighborOf(Cell c,int i,
int j)
ltCellgt
1n
TwoDimCell protected int numCells //
Total number of cells in the cell space
protected int xcoord // The
x-coordinate of this cell in the cell space
protected int ycoord // The
y-coordinate of this cell in the cell space
protected double x_pos // The x-coordinate
of this cell on the cell space display
protected double y_pos // The y-coordinate
of this cell on the cell space display
protected Pair id // Unique cell
id equals cell pos in cell space protected int
Xsize // The x-coordinate of this cell
in the cell space protected int Ysize
// The y-coordinate of this cell in the cell
space public int xDimCellspace // Cell
space x dimension size public int
yDimCellspace // Cell space x dimension
size
TwoDimCellSpace
TwoDimCellSpace provides methods for adding cells
and displaying graphics of all cells.
TwoDimCell
12lightSpreadCellSpace extends TwoDimCellSpace
- lightSpreadCell
- extends TwoDimCell
- implements fireOnce Neuron with same parameters
- outputs to nearest neighbors
- has finite refractory period
-
source cell periodically generates pulse
- wave front
- all cells are on shortest time propagation path
with same travel time - since all have same firing delay, the front is
also a shortest distance contour -
barriers dont transmit pulses
13Connecting Agents to Cellspace Environments
- mover agent
- is not in the cell space but is a component of
the coupled model - has coordinates and draws itself on same window
- gets inputs from all wavefront cells
- selects the adjacent input that is also closest
as crow flies to source - goes in the direction of the selected neighbor
lightSpreadCells have been made invisible on
window
source cell periodically generates pulse
14Connecting Agents to Cellspace Environments
(contd)
movers receive inputs on port outCoord from
active lightSpread cells
lightSpreadCells in 4 by 4 cellspace
doNeighborToNeighborCoupling() //sets up
neighborhood coupling
coupleAllTo("outCoord",m2,"in") //couples all
lightCells to mover