Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 9 Cellular Spaces

Similar presentations


Presentation on theme: "Chapter 9 Cellular Spaces"— Presentation transcript:

1 Chapter 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

2 Some Types of Models Represented in DEVS
Coupled Models Atomic Models can be components in a coupled model Partial Differential Equations 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 Fuzzy Logic Models Self Organized Criticality Models Reactive Agent Models Multi Agent Systems

3 One Dimensional DEVS Cellular Space Classes
5 6 7 8 1 2 3 4 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. OneDimCell inherits from Viewable Atomic to provide cells that are atomic in nature ViewableDigraph ViewableAtomic oneDimCellSpace extends ViewableDigraph{ public void doNeighborCoupling(){...} public void addCell(){...} public void addPlots(){...} } oneDimCell protected int id = 0; protected rand r; protected int d rawPos ,numTransitions; <oneDCell> 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; 1:n 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.

4 Example: Pulse Pipeline One Dimensional Cell Space
5 6 7 8 1 2 3 4 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; i<numCells; 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

5 Pileline 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 N=4, 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.

6 Sieve of Eratosthenes – unbounded signal speeds in DEVS Cell Space
2 3 4 5 6 8 9 10 Model building asks these kinds of questions  Identity Composite-ness Primeness Activation What do I need to know? My integer Any division by less than my integer  Not divisible by numbers below me When to start my integer signal to the right When can I know it? Who can tell me? initialization First division Survived all inputs and neighbor sends activation When neighbor sends its integer 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) ~alfeld/Eratosthenes.html

7 to distinguish primes from others send on dedicated port
Prime Sieve (cont’d) 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 temp lastComposite inPrime = x and x divides n in = n-1 out =n if (phaseIs(outPrime)) output: n on outPrime else if (phaseIs(lastComposite)) output n on out else output input on out Composite outPrime = x OneDimCellSpace. pascalCellSpace

8 Cellular Space Realization of Pascal’s Triangle
Implementation: A one-dimensional cell space with left to right neighborhood such that each cell adds its neighbor’s 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 1 2 1 1 1 1 1 1 odd even 1 3 3 1 1 1 1 1 1 4 6 4 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.

9 Cellular 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 Wolfram’s 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->0, 110->0, 101->0, 100->1, 011->1, 010->1, 001->1, 000->0 } 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. 1. – 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 -> in to North Coupling based on Neighborhood outS inS inN outN

11 Two 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 modeler’s digraph class ViewableDigraph ViewableAtomic TwoDimCellSpace { public void addCell(){...} public void doNeighborToNeighborCoupling(){...} public Cell withId(int xcoord, int ycoord){…} public Cell neighborOf(Cell c,int i, int j){…} <Cell> 1:n 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

12 lightSpreadCellSpace extends TwoDimCellSpace
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 don’t transmit pulses

13 Connecting 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

14 Connecting Agents to Cellspace Environments (cont’d)
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


Download ppt "Chapter 9 Cellular Spaces"

Similar presentations


Ads by Google