Cellular Automata Modeling Environment & Library Lev Naumov [email protected].

38
Cellular Automata Modeling Environment & Library Lev Naumov [email protected]

Transcript of Cellular Automata Modeling Environment & Library Lev Naumov [email protected].

Page 1: Cellular Automata Modeling Environment & Library Lev Naumov levnaumov@mail.ru.

CellularAutomataModelingEnvironment &Library

Lev [email protected]

Page 2: Cellular Automata Modeling Environment & Library Lev Naumov levnaumov@mail.ru.

2

What Is CAME&L?

Environment, which allows to research, visualize and solve problems, basing cellular automata concept

Tool for distributed parallel computations and study of parallel algorithms

Library, which represents rich toolkit for building solutions

Page 3: Cellular Automata Modeling Environment & Library Lev Naumov levnaumov@mail.ru.

3

What Are Cellular Automata?

Cellular automata – simple models, which are used for studying complex systems behavior in different fields of science

These automata are discrete dynamic systems, which work can be completely described in the terms of local interactions

Cellular systems form common paradigm of parallel computations as Turing machines do for the consecutive computations

Page 4: Cellular Automata Modeling Environment & Library Lev Naumov levnaumov@mail.ru.

4

What for Cellular Automata Are Applicable?For modeling of processes or distributed

systems in physics, mathematics, computer sciences, chemistry, biology, psychology, meteorology, social sciences and other fields of science• “Cellular automaton” is discrete analogue of

“field” conceptFor using as spaces of parallel

computations for tasks solving

Page 5: Cellular Automata Modeling Environment & Library Lev Naumov levnaumov@mail.ru.

5

Why Cellular Automata?

Common and most simple models of parallel computations

Parallel tasks are urgent and important• Throughput of single processor is limited by

technological causes• There are a lot of “heavy” tasks which can and need

to be solved using parallel computations• There are a lot of tasks which are based on space-

distributed computer systems

Page 6: Cellular Automata Modeling Environment & Library Lev Naumov levnaumov@mail.ru.

6

Definition of Cellular Automaton

Cellular automaton A is a set of four objectsA = <G, Z, N, f>, where

G – grid, set of cells Z – set of possible cells states N – set, which describes cells neighborhood f – transition function, rules of the automaton:

• Z|N|+1Z (for automaton, which has cells “with memory”)

• Z|N|Z (for automaton, which has “memoryless” cells)

Page 7: Cellular Automata Modeling Environment & Library Lev Naumov levnaumov@mail.ru.

7

Two-Dimensional Grids

Cells that have a common edge with the involved are named as “main neighbors” of the cell (are showed with hatching)

The set of actual neighbors of the cell a, which can be found according to N, is denoted as N(a)

Page 8: Cellular Automata Modeling Environment & Library Lev Naumov levnaumov@mail.ru.

8

Basic Cellular Automata Properties Transition function is to be local System is to be similar for all the cells

• To avoid side effects grid can use boundary conditions

Torus Mobius band Constant

All cells get their new values simultaneously, at the end of the timestep, after all new values were calculated for all cells

Page 9: Cellular Automata Modeling Environment & Library Lev Naumov levnaumov@mail.ru.

9

Definition of the Rings

Ring is the set of cells. It can be introduced for each cell on the grid

Let us assume the cell itself to be its cell of the zero ring and its nearest neighbors to be the cells of first ring of the involved cell

For the current cell, its cells of the i-th ring are nearest neighbors of members of (i–1)-th ring, excluding cells of (i–1)-th and (i–2)-th rings

Page 10: Cellular Automata Modeling Environment & Library Lev Naumov levnaumov@mail.ru.

10

Definition of the Rings

Formally, if R(a, i) is a set of cells of i-th ring of cell a, then if N describes cells neighborhood as the set of its nearest neighbors, following formula will take place

Page 11: Cellular Automata Modeling Environment & Library Lev Naumov levnaumov@mail.ru.

11

Rings for Grid of Triangles

Different rings are showed with hatching or color

Page 12: Cellular Automata Modeling Environment & Library Lev Naumov levnaumov@mail.ru.

12

Rings for Grid of Squares

Different rings are showed with hatching or color

Page 13: Cellular Automata Modeling Environment & Library Lev Naumov levnaumov@mail.ru.

13

Rings for Grid of Hexagons

Different rings are showed with hatching or color

Page 14: Cellular Automata Modeling Environment & Library Lev Naumov levnaumov@mail.ru.

14

Definition of the Metrics

Distance function D(a, b) for retrieving remoteness between cells a and b can be denoted as follows

It is proved that this function satisfies to all metrics properties

The notion of ring may be generalized for multi-dimensional grids and the distance function, given by last formula, will remain the same

Page 15: Cellular Automata Modeling Environment & Library Lev Naumov levnaumov@mail.ru.

15

The Problem

“Cellular automaton” is specific parallel architecture so it needs specific hardware or at least software platform

Multifunctional environment for solving problems with the help of cellular automata will allow to use computers as

assembly for physical, chemical, biological and other experiments (may be very expensive)

tool for execution, visualization and analysis of parallel computations

Page 16: Cellular Automata Modeling Environment & Library Lev Naumov levnaumov@mail.ru.

16

CAME&LCellular

Automata

Modeling

Environment &

Library

Windows-based software, that is desired to be simple, extensible workspace for complicated cellular calculations

Page 17: Cellular Automata Modeling Environment & Library Lev Naumov levnaumov@mail.ru.

17

Why CAME&L? Existing products put limitations

over automata that can be used Majority of existing products do

not satisfy modern requirements to user interface and do not support contemporary technologies

Many existing products have complicated languages for cellular automata description

Page 18: Cellular Automata Modeling Environment & Library Lev Naumov levnaumov@mail.ru.

18

Advantages of CAME&L Existing products put limitations

over automata that can be used Majority of existing products do

not satisfy modern requirements to user interface and do not support contemporary technologies

Many existing products have complicated languages for cellular automata description

No limitations at all

Handy user interface with the support of useful features

C++ or any other language that was developed

Page 19: Cellular Automata Modeling Environment & Library Lev Naumov levnaumov@mail.ru.

19

CAME&L Components

Each experiment is controlled and implemented by “components”

Components may be used in different combinations and add arbitrary functionality

Each component declares list of its parameters which are used for the tuning

Each component is a dynamic link library Components are to be realized using Cellular

Automata Developing Library (CADLib)

Page 20: Cellular Automata Modeling Environment & Library Lev Naumov levnaumov@mail.ru.

20

CADLib

For CADLib User = Developer = Researcher

CADLib presents rich set of instruments for components development

This is a С++ class library for further enlarging and reusing

It also contains some useful functions, constants and macrodefinitions

Page 21: Cellular Automata Modeling Environment & Library Lev Naumov levnaumov@mail.ru.

21

CADLib

Rich and well structured class hierarchy provides easy-to-use and powerful toolkit

It makes possible to customize all necessary behavior of system

Page 22: Cellular Automata Modeling Environment & Library Lev Naumov levnaumov@mail.ru.

22

CAME&L Components

Each automaton consists of four components Grid – implements visualization of grid and cells

navigation Datum – maintains data storage Metrics – provides the relationship of neighborhood,

distance function and assigns coordinates to cells Rules – describes computations (initialization,

iteration and finalization)Other type of components: Analyzer – allows to keep an eye on definite

properties of automaton

Page 23: Cellular Automata Modeling Environment & Library Lev Naumov levnaumov@mail.ru.

23

Why Is Separate Metrics Component Needed?It was possible to place necessary

functionality to the datum componentMetrics is separate component because

this fact gives opportunity to use non-standard coordinate systems. For example, generalized coordinates

Page 24: Cellular Automata Modeling Environment & Library Lev Naumov levnaumov@mail.ru.

24

What is Generalized Coordinates?The idea is to enumerate all cells of the grid. It

must be done without any blanks. Each number is to have one and only one corresponding cell

There must be the way to find cells nearest neighbors. It will be enough to work with any neighborhood

The method of associating cells with generalized coordinates can be different. The main aim is to introduce them in the way, which allows to retrieve cells neighbors as fast as possible

Page 25: Cellular Automata Modeling Environment & Library Lev Naumov levnaumov@mail.ru.

25

Spiral Generalized Coordinates for Hexagonal GridChoose any cell

as zero cell and then enumerate cells in each its ring clockwise

There are formulae for retrieving coordinates of nearest cells in this metrics

Page 26: Cellular Automata Modeling Environment & Library Lev Naumov levnaumov@mail.ru.

26

Generalized Coordinates for Grid of TrianglesAfter applying spiral

generalized coordinates for hexagons, each triangles coordinate can be got as coordinate of hexagon, multiplied by six and added index of triangle inside the hexagon

Page 27: Cellular Automata Modeling Environment & Library Lev Naumov levnaumov@mail.ru.

27

Generalized Coordinates for Grid of Triangles In this metrics there is no need to consider two

variants of cells orientation separately Tests shows, that this way of introducing of

generalized coordinates for the grid of triangles allows to calculate the nearest neighbor cells several times faster than a spiral way for this grid. The cause is in• complexity of a ring for the grid of triangles• recursion which is used for spiral coordinates of non-

main cells neighbors, but in the grid of hexagons all cells neighbors are main

Page 28: Cellular Automata Modeling Environment & Library Lev Naumov levnaumov@mail.ru.

28

Generalized Coordinates Based on Composite CubiclesUseful for performance optimization

• as for triangular grid based on hexagonal cubicles

Allows to introduce coordinates for complicated grids • as the “soccer ball” grid

Page 29: Cellular Automata Modeling Environment & Library Lev Naumov levnaumov@mail.ru.

29

Spiral Generalized Coordinates

There are formalisms of spiral generalized coordinates for all three possible two-dimensional grids of regular polygons

This concept may be used for multidimensional and more complicated grids

Page 30: Cellular Automata Modeling Environment & Library Lev Naumov levnaumov@mail.ru.

30

Generalized Coordinates – Disadvantage and Advantages Main disadvantage of the

offered approach is that calculations of neighbors are slower than, for example, for the Cartesian case

Generalized coordinates provide a universal way of data storage for different grids

Grid may be easily enlarged if it is necessary

Serial data is easier to serialize and store

Independency from the zero-cells position gives the opportunity to move it to the place where it would be more useful

Generalized coordinates is just a concept, so it could be adopted for the definite task

Page 31: Cellular Automata Modeling Environment & Library Lev Naumov levnaumov@mail.ru.

31

Generalized Coordinates for Parallel ComputationsCellular automata are the models of parallel

computations with infinite extent of parallelism. Using the generalized coordinates the system with infinite extent of parallelism can be emulated with the help of several interacting Turing machines. A single machine used to work with data storage (the tape) and other machines are used for neighbors calculations and synchronization

Page 32: Cellular Automata Modeling Environment & Library Lev Naumov levnaumov@mail.ru.

32

Rules Component Functions

Other existing projects Rules = Transition function Use many languages for

transition functions description

CAME&L Rules component fully

describes computations• Method of parallelization• Computations optimization• …• Transition function

Single rules component may represent a parser of language for transition functions description and work with arbitrary transition functions (not with only one)

Page 33: Cellular Automata Modeling Environment & Library Lev Naumov levnaumov@mail.ru.

33

Analysis of Experiment

Rules component declares list of values which are interesting for the researcher

These values are calculated during the iteration

Analyzer component allows to study these values changing• Draw graphs• Build reports to file• …

Page 34: Cellular Automata Modeling Environment & Library Lev Naumov levnaumov@mail.ru.

34

Cellular Automata Properties In CAME&L Transition function is to

be local System is to be similar for

all the cells• To avoid side effects grid

can use boundary conditions

All cells get their new values simultaneously, at the end of the timestep, after all new values were calculated for all cells

Transition function can be not local

System can be not similar for all the cells

• Standard datum components allows to select boundary conditions

Each cells can get new value just after it was calculated

Page 35: Cellular Automata Modeling Environment & Library Lev Naumov levnaumov@mail.ru.

35

CAME&L Features Allows to use arbitrary automata without any

limitations Has handy rich user interface. Supports

• Undo-redo functionality• Clipboard operations• Printing, saving pictures for illustrating articles• Many many other features

Stores data in XML files, that can become standard for cellular information interchange

Can compress data on the fly using BZip2 algorithm

Page 36: Cellular Automata Modeling Environment & Library Lev Naumov levnaumov@mail.ru.

36

CAME&L Features

Has multidocument interface• allows to work with several automata simultaneously• allows to implement automata interactions

Has rich toolkit to control, study and analyze the experiment

Allows to build graphs of computations performance

Is provided with examples of different components, which can be used for users tasks solving or as a basis of users components

Page 37: Cellular Automata Modeling Environment & Library Lev Naumov levnaumov@mail.ru.

37

CAME&L Features

Allows to perform parallel computations• On multiprocessor computer• On cluster

Allows to arrange clusters• In local area network• In the Internet

Uses novel network Commands Transfer Protocol (CTP) for cluster computations

• Fast, reliable and featureful

Page 38: Cellular Automata Modeling Environment & Library Lev Naumov levnaumov@mail.ru.

38

CAME&L Project

Project was announced on International Conference on Computational Sciences 2003 (Melbourne – Saint-Petersburg, June 2003) and attracts interest of scientists

The work is in progress