Cellular Automata Modeling Environment and Library

overwhelmedblueearthΤεχνίτη Νοημοσύνη και Ρομποτική

1 Δεκ 2013 (πριν από 3 χρόνια και 9 μήνες)

84 εμφανίσεις

C
ellular

A
utomata

M
odeling

E
nvironment
&

L
ibrary

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

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

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”

concept


For

using

as

spaces

of

parallel

computations

for

tasks

solving

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

6

Definition of Cellular Automaton

Cellular

automaton

A

is

a

set

of

four

objects

A

=

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

Z

(
for

automaton,

which

has

cells

“with

memory”)


Z
|
N
|

Z

(
for

automaton,

which

has

“memoryless”

cells)

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
)

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

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

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

11

Rings for Grid of Triangles

Different

rings

are

showed

with

hatching

or

color

12

Rings for Grid of Squares

Different

rings

are

showed

with

hatching

or

color

13

Rings for Grid of Hexagons

Different

rings

are

showed

with

hatching

or

color

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

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

16

CAME
&
L

C
ellular

A
utomata

M
odeling

E
nvironment

&

L
ibrary

Windows
-
based

software,

that

is

desired

to

be

simple,

extensible

workspace

for

complicated

cellular

calculations

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

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

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

C
ellular

A
utomata

D
eveloping

Lib
rary

(CADLib)

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

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

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

23

Why Is Separate Metrics
Component Needed?


It

was

possible

to

place

necessary

functionality

to

the

datum

component


Metrics

is

separate

component

because

this

fact

gives

opportunity

to

use

non
-
standard

coordinate

systems
.

For

example,

generalized

coordinates

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

25

Spiral Generalized Coordinates

for Hexagonal Grid

Choose

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

26

Generalized
Coordinates

for
Grid

of
Triangles

After

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

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

28

Generalized Coordinates Based
on Composite Cubicles


Useful

for

performance

optimization



as

for

triangular

grid

based

on

hexagonal

cubicles


Allows

to

introduce

coordinates

for

complicated

grids



as

the

“soccer

ball”

grid

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

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

31

Generalized Coordinates for
Parallel Computations

Cellular

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

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)

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




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

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

BZip
2

algorithm

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

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

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