a new programming paradigm inspired by algorithmic chemistries upp 2004 september 2004 wolfgang...

44
A new Programming Paradigm inspired by Algorithmic Chemistries UPP 2004 September 2004 Wolfgang Banzhaf, Memorial University of Newfoundland, Canada and Christian Lasarczyk, Universität Dortmund, Germany

Upload: amos-jordan

Post on 20-Jan-2016

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: A new Programming Paradigm inspired by Algorithmic Chemistries UPP 2004 September 2004 Wolfgang Banzhaf, Memorial University of Newfoundland, Canada and

A new Programming Paradigm inspired by

Algorithmic ChemistriesUPP 2004

September 2004

Wolfgang Banzhaf, Memorial University of Newfoundland, Canada

and

Christian Lasarczyk, Universität Dortmund, Germany

Page 2: A new Programming Paradigm inspired by Algorithmic Chemistries UPP 2004 September 2004 Wolfgang Banzhaf, Memorial University of Newfoundland, Canada and

14.9.2004 W. Banzhaf and C. Lasarczyk 2

Overview

• Conventional Computers

• The organic realm

• Artificial Chemistries

• Genetic Programming

• GP of an AC

Page 3: A new Programming Paradigm inspired by Algorithmic Chemistries UPP 2004 September 2004 Wolfgang Banzhaf, Memorial University of Newfoundland, Canada and

14.9.2004 W. Banzhaf and C. Lasarczyk 3

Conventional Computers

• Information stored in bit sequences at memory locations

• Execution of program through instruction flow in specific sequence (translated into locations via the program counter)

• Paradigm follows the metaphor of a macroscopic machine: Parts are put together at specific locations in order to work properly

• Order of construction and locations essential to produce a working machine

Space and time are determined rigidly

Page 4: A new Programming Paradigm inspired by Algorithmic Chemistries UPP 2004 September 2004 Wolfgang Banzhaf, Memorial University of Newfoundland, Canada and

14.9.2004 W. Banzhaf and C. Lasarczyk 4

The Organic Realm

• Molecules interact via reactions of different strength

• Single reactions are brought about by collisions of molecules, which in turn are generated by Brownian motion

• Both time and space of events are difficult to predict

• Sequences and locations of reactions cannot be easily specified

• Specificity is generated through patterns. 3D key-lock recognition is widely used as means of coordination

Space and time cannot be determined rigidly

Page 5: A new Programming Paradigm inspired by Algorithmic Chemistries UPP 2004 September 2004 Wolfgang Banzhaf, Memorial University of Newfoundland, Canada and

14.9.2004 W. Banzhaf and C. Lasarczyk 5

The Organic Realm II

• Brownian motion as a source of energy and randomness

• Indeterminism in space and time

• Natural forces generate key-lock patterns and mechanisms

• Adaptivity is built-in at lowest level

How to achieve function?

• Quality measure for function: Fitness

• Artificial Evolution (breeding): Variation and selection

Page 6: A new Programming Paradigm inspired by Algorithmic Chemistries UPP 2004 September 2004 Wolfgang Banzhaf, Memorial University of Newfoundland, Canada and

14.9.2004 W. Banzhaf and C. Lasarczyk 6

Artificial Chemistries as a Tool for Exploration

Objects and their interaction

• In an AC, an arbitray set of objects can be created to interact on terms the researcher defines.

• The system is then run on a computer and examined in its behavior.• An Artificial Chemistry consists of

– A set of objects (called molecules)– A set of interaction rules (called reaction or collision rules), and– A definition of the population dynamics

• Inspired by work on GAMMA and CHAM

Page 7: A new Programming Paradigm inspired by Algorithmic Chemistries UPP 2004 September 2004 Wolfgang Banzhaf, Memorial University of Newfoundland, Canada and

14.9.2004 W. Banzhaf and C. Lasarczyk 7

Principles of Artificial Chemistries

• Objects / MoleculesCharacters, numbers, symbol strings, lambda-expressions, binary strings, proof statements, abstract data structures, magnets

• ReactionsTables of reactions (explicit), string matching rules, lambda-calculus operations, arithmetic operations, term rewriting rules, state transitions (e.g. finite automata), computations (e.g. Turing machine operations)

• Dynamics Differential equations, explicit simulation, „meta-dynamics“, mixed approaches

Page 8: A new Programming Paradigm inspired by Algorithmic Chemistries UPP 2004 September 2004 Wolfgang Banzhaf, Memorial University of Newfoundland, Canada and

14.9.2004 W. Banzhaf and C. Lasarczyk 8

Principles of Artificial Chemistries (II)

An AC is tuple {S, R, A} with

•S (multi)set of objects (molecules),S = (s1,s2,...sn)

•R set of rules (reactions) R = (r1,r2,...rk), each of one of the formsr1) a b r2) a + b b r3) a b + c r4) a + b c + d

where a,b,c,d are from S

•A algorithm driving the system (dynamics)

Page 9: A new Programming Paradigm inspired by Algorithmic Chemistries UPP 2004 September 2004 Wolfgang Banzhaf, Memorial University of Newfoundland, Canada and

14.9.2004 W. Banzhaf and C. Lasarczyk 9

Example: Matrix chemistry (1993)

Bit strings are interpreted as operators (binary matrices);

Operators generate, in interaction with bit strings newbitstrings (matrix multiplication):

Self replicating bit strings or those which produce other thatin turn produce them will be dominant in the longer run.

Stable organizations appear spontaneously

Bit strings

Matrices

Page 10: A new Programming Paradigm inspired by Algorithmic Chemistries UPP 2004 September 2004 Wolfgang Banzhaf, Memorial University of Newfoundland, Canada and

14.9.2004 W. Banzhaf and C. Lasarczyk 10

What is Genetic Programming?

• Induction of computer code by evolutionary means– Darwinian approach– Application of stochastic operators– Population-based

• Low-level and high-level computer code – Parse trees (Koza)– C-code, JAVA-code– Machine code (AIM)

• GP useful for other types of algorithms– Neural Networks, circuits– Mathematical Formulae

Page 11: A new Programming Paradigm inspired by Algorithmic Chemistries UPP 2004 September 2004 Wolfgang Banzhaf, Memorial University of Newfoundland, Canada and

14.9.2004 W. Banzhaf and C. Lasarczyk 11

What is Genetic Programming? (II)

A Darwinian approach to prgramming:

The variation – selection loop– Invalidates probability argument

– Appreciates relative performance advantages

DiversityGenerator

SelectionDevice

Page 12: A new Programming Paradigm inspired by Algorithmic Chemistries UPP 2004 September 2004 Wolfgang Banzhaf, Memorial University of Newfoundland, Canada and

14.9.2004 W. Banzhaf and C. Lasarczyk 12

What is Genetic Programming? (III)

• A population of programs is subjected to the GP algorithm

• Programs consist of elements which can be combined

– Terminals (variables and constants) and functions

– Instructions (having operators and operands)

– Nodes and edges of a graph

• The GP-algorithm uses

– Operators for reproduction, mutation and recombination (for the production of program variants)

– An evaluation measure

– A selection operator

Page 13: A new Programming Paradigm inspired by Algorithmic Chemistries UPP 2004 September 2004 Wolfgang Banzhaf, Memorial University of Newfoundland, Canada and

14.9.2004 W. Banzhaf and C. Lasarczyk 13

How does it work?

?Input Output

•Generation of different programs that solve the problem more or less accurately

•Test of programs on „fitness cases“

•Improvement of better solutions

Page 14: A new Programming Paradigm inspired by Algorithmic Chemistries UPP 2004 September 2004 Wolfgang Banzhaf, Memorial University of Newfoundland, Canada and

14.9.2004 W. Banzhaf and C. Lasarczyk 14

Genetic Programming of an AC

• Choose a particular representation– Multiset of instructions – Let them “react”: Execute an instruction– Data (values in registers) are transformed in multiple ways, depending

on which instruction is executed when– If output of an instruction is picked up by another instruction, then a

more complex computation is realized– Lock-Key principle: Output register of Instruction_1 is used as input

register of Instruction_2

• Implementation– Contiguous block of random access memory for technical and practical

reasons

Page 15: A new Programming Paradigm inspired by Algorithmic Chemistries UPP 2004 September 2004 Wolfgang Banzhaf, Memorial University of Newfoundland, Canada and

14.9.2004 W. Banzhaf and C. Lasarczyk 15

Evaluation

• Linear GP– Linear access

• ACs– Random access

Page 16: A new Programming Paradigm inspired by Algorithmic Chemistries UPP 2004 September 2004 Wolfgang Banzhaf, Memorial University of Newfoundland, Canada and

14.9.2004 W. Banzhaf and C. Lasarczyk 16

Evaluation – Linear GP

Page 17: A new Programming Paradigm inspired by Algorithmic Chemistries UPP 2004 September 2004 Wolfgang Banzhaf, Memorial University of Newfoundland, Canada and

14.9.2004 W. Banzhaf and C. Lasarczyk 17

Evaluation – Algorithmic Chemistry

Page 18: A new Programming Paradigm inspired by Algorithmic Chemistries UPP 2004 September 2004 Wolfgang Banzhaf, Memorial University of Newfoundland, Canada and

14.9.2004 W. Banzhaf and C. Lasarczyk 18

Crossover

• Genetic Programming– Sequence

manipulated by crossover

– Bloat

• Algorithmic Chemistries– Sequence emerged– Inheritance of

frequencies

Page 19: A new Programming Paradigm inspired by Algorithmic Chemistries UPP 2004 September 2004 Wolfgang Banzhaf, Memorial University of Newfoundland, Canada and

14.9.2004 W. Banzhaf and C. Lasarczyk 19

Crossover – Linear GP

Page 20: A new Programming Paradigm inspired by Algorithmic Chemistries UPP 2004 September 2004 Wolfgang Banzhaf, Memorial University of Newfoundland, Canada and

14.9.2004 W. Banzhaf and C. Lasarczyk 20

Crossover – Algorithmic Chemistrie

Page 21: A new Programming Paradigm inspired by Algorithmic Chemistries UPP 2004 September 2004 Wolfgang Banzhaf, Memorial University of Newfoundland, Canada and

14.9.2004 W. Banzhaf and C. Lasarczyk 21

Result - Sine Function

Page 22: A new Programming Paradigm inspired by Algorithmic Chemistries UPP 2004 September 2004 Wolfgang Banzhaf, Memorial University of Newfoundland, Canada and

14.9.2004 W. Banzhaf and C. Lasarczyk 22

Result - Thyroid Problem

Page 23: A new Programming Paradigm inspired by Algorithmic Chemistries UPP 2004 September 2004 Wolfgang Banzhaf, Memorial University of Newfoundland, Canada and

14.9.2004 W. Banzhaf and C. Lasarczyk 23

Length & Entropy – Sine Function

Page 24: A new Programming Paradigm inspired by Algorithmic Chemistries UPP 2004 September 2004 Wolfgang Banzhaf, Memorial University of Newfoundland, Canada and

14.9.2004 W. Banzhaf and C. Lasarczyk 24

Page 25: A new Programming Paradigm inspired by Algorithmic Chemistries UPP 2004 September 2004 Wolfgang Banzhaf, Memorial University of Newfoundland, Canada and

14.9.2004 W. Banzhaf and C. Lasarczyk 25

Dataflow

Page 26: A new Programming Paradigm inspired by Algorithmic Chemistries UPP 2004 September 2004 Wolfgang Banzhaf, Memorial University of Newfoundland, Canada and

14.9.2004 W. Banzhaf and C. Lasarczyk 26

Outlook

• Fuzzy hierarchies

• Multiprocessor ACs

• More problems, e.g. Sorting Networks

• Statistical Evaluation of the Approach

Page 27: A new Programming Paradigm inspired by Algorithmic Chemistries UPP 2004 September 2004 Wolfgang Banzhaf, Memorial University of Newfoundland, Canada and

14.9.2004 W. Banzhaf and C. Lasarczyk 27

Fuzzy Hierarchies

• Gradual linearization

• From N(x,) to N(x,0)

• Via:

Page 28: A new Programming Paradigm inspired by Algorithmic Chemistries UPP 2004 September 2004 Wolfgang Banzhaf, Memorial University of Newfoundland, Canada and

14.9.2004 W. Banzhaf and C. Lasarczyk 28

Multiprocessor AC• Thyroid problem

Page 29: A new Programming Paradigm inspired by Algorithmic Chemistries UPP 2004 September 2004 Wolfgang Banzhaf, Memorial University of Newfoundland, Canada and

14.9.2004 W. Banzhaf and C. Lasarczyk 29

References

• Artificial Chemistries – A Review, Artificial Life, 7, 2001, 225 – 275 (by P.Dittrich, J. Ziegler and W. B.)

• Genetic Programming of an Artificial Chemistry, Proc. of Genetic Programming in Theory and Practice Workshop, Ann Arbor, MI, 2004, Kluwer Academic, 2004

• http://www.cs.mun.ca/~banzhaf/

Page 30: A new Programming Paradigm inspired by Algorithmic Chemistries UPP 2004 September 2004 Wolfgang Banzhaf, Memorial University of Newfoundland, Canada and

14.9.2004 W. Banzhaf and C. Lasarczyk 30

Length & Entropy – Thyroid Problem

Page 31: A new Programming Paradigm inspired by Algorithmic Chemistries UPP 2004 September 2004 Wolfgang Banzhaf, Memorial University of Newfoundland, Canada and

14.9.2004 W. Banzhaf and C. Lasarczyk 31

Matrix reactions – Step by step

000001010

011000000

010011000

010111010

010011111

010011000

Page 32: A new Programming Paradigm inspired by Algorithmic Chemistries UPP 2004 September 2004 Wolfgang Banzhaf, Memorial University of Newfoundland, Canada and

14.9.2004 W. Banzhaf and C. Lasarczyk 32

Matrix reactions – Step by step

000001010

011000000

010011000

010111010

010011111

010011000

Page 33: A new Programming Paradigm inspired by Algorithmic Chemistries UPP 2004 September 2004 Wolfgang Banzhaf, Memorial University of Newfoundland, Canada and

14.9.2004 W. Banzhaf and C. Lasarczyk 33

Matrix reactions – Step by step

000001010

011000000

010011000

010111010

010011111

010011000

010011111 + 010111010 ?

Page 34: A new Programming Paradigm inspired by Algorithmic Chemistries UPP 2004 September 2004 Wolfgang Banzhaf, Memorial University of Newfoundland, Canada and

14.9.2004 W. Banzhaf and C. Lasarczyk 34

Matrix reactions – Step by step

000001010

011000000

010011000

010111010

010011111

010011000

010011111

010111010 ?

Page 35: A new Programming Paradigm inspired by Algorithmic Chemistries UPP 2004 September 2004 Wolfgang Banzhaf, Memorial University of Newfoundland, Canada and

14.9.2004 W. Banzhaf and C. Lasarczyk 35

Matrix reactions – Step by step

000001010

011000000

010011000

010111010

010011111

010011000

010011111

010111010 010

Page 36: A new Programming Paradigm inspired by Algorithmic Chemistries UPP 2004 September 2004 Wolfgang Banzhaf, Memorial University of Newfoundland, Canada and

14.9.2004 W. Banzhaf and C. Lasarczyk 36

Matrix reactions – Step by step

000001010

011000000

010011000

010111010

010011111

010011000

010011111

010111010 010110

Page 37: A new Programming Paradigm inspired by Algorithmic Chemistries UPP 2004 September 2004 Wolfgang Banzhaf, Memorial University of Newfoundland, Canada and

14.9.2004 W. Banzhaf and C. Lasarczyk 37

Matrix reactions – Step by step

000001010

011000000

010011000

010111010

010011111

010011000

010011111

010111010 010110101

Page 38: A new Programming Paradigm inspired by Algorithmic Chemistries UPP 2004 September 2004 Wolfgang Banzhaf, Memorial University of Newfoundland, Canada and

14.9.2004 W. Banzhaf and C. Lasarczyk 38

Matrix reactions – Step by step

000001010

011000000

010011000

010111010

010011111

010011000

010110101

Page 39: A new Programming Paradigm inspired by Algorithmic Chemistries UPP 2004 September 2004 Wolfgang Banzhaf, Memorial University of Newfoundland, Canada and

14.9.2004 W. Banzhaf and C. Lasarczyk 39

Matrix reactions – Step by step

000001010

011000000

010011000

010111010

010011111

010011000

010110101

Page 40: A new Programming Paradigm inspired by Algorithmic Chemistries UPP 2004 September 2004 Wolfgang Banzhaf, Memorial University of Newfoundland, Canada and

14.9.2004 W. Banzhaf and C. Lasarczyk 40

Matrix reactions – Step by step

000001010

011000000

010011000

010111010

010011111

010011000

010110101

010110101

Page 41: A new Programming Paradigm inspired by Algorithmic Chemistries UPP 2004 September 2004 Wolfgang Banzhaf, Memorial University of Newfoundland, Canada and

14.9.2004 W. Banzhaf and C. Lasarczyk 41

Matrix reactions – Step by step

000001010

011000000

010011000

010111010

010011111

010011000

010110101

Page 42: A new Programming Paradigm inspired by Algorithmic Chemistries UPP 2004 September 2004 Wolfgang Banzhaf, Memorial University of Newfoundland, Canada and

14.9.2004 W. Banzhaf and C. Lasarczyk 42

Matrix reactions – Step by step

000001010

011000000

010011000

010111010

010011111

010011000

010110101

Page 43: A new Programming Paradigm inspired by Algorithmic Chemistries UPP 2004 September 2004 Wolfgang Banzhaf, Memorial University of Newfoundland, Canada and

14.9.2004 W. Banzhaf and C. Lasarczyk 43

Matrix reactions – Step by step

000001010

011000000

010111010

010011111

010011000

010110101

Page 44: A new Programming Paradigm inspired by Algorithmic Chemistries UPP 2004 September 2004 Wolfgang Banzhaf, Memorial University of Newfoundland, Canada and

14.9.2004 W. Banzhaf and C. Lasarczyk 44

Matrix reactions – Step by step

1 Generation = M Steps