September 21, 2014
2-D Growth Model
This model is a stochastic 2-D cellular automata written in VBA that uses Excel 2010 conditional formatting to generate a map. An example map is shown below representing the the state after 100 generations. The grid is originally seeded with 1’s in random cells and the probability of a ‘birth’ in a cell is proportional to a function of the cell contents and its immediate neighbours. The VBA code is unprotected and the code needed to implement the model is quite short (about 100 lines of code) although a few hundred more lines of code are required for the interface. The model worksheet displays the map and the parameters sheet contains the model parameters and some result statistics. A modal dialog box is used to set parameters. If this is closed the underlying sheets can be copied and pasted etc… To regenerate the dialog click on the ‘Run Population Model’ button in the Parameters sheet. Down load from download page or here GenerateClusteredLocations.
The model parameters can be changed through the dialog box that appears when the workbook is opened. The growth rule is based on the contents of the cell and the 8 adjacent cells. A center weighting is applied to the cell and outer weighting to the adjacent cells. Thus probability of a new item is given by:
(Cell Item Count x Center Weight + Total Items in Adjacent Cells x Outer Weight) / Maximum Weight
If the cell and all its neighbours are empty then a Minimum Weight value is used in the numerator. If the calculated value exceeds one then a probability of one is used.
Grid Size – The size of square grid used can be adjusted
Initial Population – The selected number of items is randomly assigned
Center Weight - Multiplier for center cell item count
Outer Weight – Multiplier for total items in adjacent cells
Minimum Weight – Weight used if cell and its neighbours are empty
Maximum Weight – See above
Generations – Number of full model iterations
Max Items in Cell – Once this is reached no more items are added to cell
Buttons and check boxes should be self explanatory – just experiment.