1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

51
1 Digital Universes BARAK NAVEH, www.cs.bgu.ac.il/~barnav Next > < Previous
  • date post

    19-Dec-2015
  • Category

    Documents

  • view

    216
  • download

    1

Transcript of 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

Page 1: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

1

Digital Universes

BARAK NAVEH, www.cs.bgu.ac.il/~barnav

Next >< Previous

Page 2: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

2

Evolution in Other Contexts

Life on Earth is a product of evolution by natural selection operating in the medium of medium of carbon chemistrycarbon chemistry.

However, in theory, evolution is not limitedevolution is not limited to Earth, nor to carbon chemistry.

Just as it may occur on other planetsmay occur on other planets, it may also operate in other mediamay also operate in other media, such as the medium of digital computationmedium of digital computation.

Page 3: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

3

Carbon-Based Organization

The organizationorganization generated by evolution generated by evolution spans about twelve orders of magnitude of scale.

from the molecular to the ecosystem level.

Page 4: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

4

Evolution in Organic Medium

Organic lifeOrganic life uses energyuses energy and organizes matterorganizes matter.

Evolution on Earth has organized matter from the molecular level up to the ecosystem level.

Page 5: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

5

Evolution in Digital Medium

Can we use evolution to developdevelop such organization?

Can life use CPU-timeCPU-time to organize memoryorganize memory?

Can we use evolution to synthesize synthesize digital lifedigital life?

Page 6: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

6

What is

Life ?No clear definition.

We will regard to an object as alive if it is Self-replicatingSelf-replicating Capable of open-ended evolutionopen-ended evolution

Page 7: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

7

Tom Ray’s Tierra Project

Page 8: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

8

The Creatures

Self-replicating machine code programsmachine code programs.

Why machine code?(most natural to the machine)

Machine instructions remind us of amino acids because they are “chemically active”.

(actively manipulate bits, bytes, CPU registers)

The “genomegenome” of a creature is the sequence the sequence of its machine instructionsof its machine instructions.

Page 9: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

9

The Environment – Tierra VM

Why Virtual Machine? Avoid the threat of evolving hostile code such as

viruses or worms. Von Neumann type machine languages are machine languages are

fragilefragile, any mutation or recombinationmutation or recombination event is almost certain to completely break programalmost certain to completely break program.

To make it especially hospitable to synthetic life.

Tierra is a (simulated) parallel computerparallel computer with a processor for each creature.

Page 10: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

10

Each CPUContains

• 2 address registers + 2 numeric registers• Small Stack + Stack pointer• Instruction pointer • Flags register to indicate error conditions

Performs fetch-decode-execute-inc(IP) cycleHas a simple instruction set for

• Arithmetics, bit manipulation • Moving data between registers and RAM• Control “instruction pointer” (IP)

Computations are probabilisticprobabilistic • MutationsMutations occur at some low rate

Page 11: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

11

The Tierran Language

32 instructions represented by five bitsfive bits, operands included.

Numeric operands eliminatedNumeric operands eliminated Instruction set need not include all possible

integers. CPU registers and stack are the only operands of

instructions. Bit flipping and shifting is used to synthesize

numbers.

Errors that cause instructions to fail make them have no effect.

Page 12: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

12

Template Addressing

Numeric operands are normally used to specify addresses, such as absolute or relative addresses for jmpjmp instruction.

Numeric operands were eliminated• (another method is needed)

In Tierra, the jmpjmp instruction uses a templatetemplate instead of an absolute or relative address.

Page 13: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

13

Template Addressing

Templates are “borrowed” from molecular biology.

Molecules “address” one another by having complementary shapes.

Templates are complementary Templates are complementary patternspatterns of zeros and ones.

Templates are built from two kinds of nopnop instructions: nop0nop0 and nop1nop1

Page 14: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

14

Template Addressing

The instruction sequence: jmpjmp nop0nop0 nop0nop0 nop1nop1

causes execution of the program to jump to the nearest occurrence of the instruction sequence:

nop1nop1 nop1nop1 nop0nop0Why use complementaritycomplementarity?

so that the jmpjmp will never jump to itself.

Page 15: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

15

Instruction Setnop_0 | nop_1 no operation (template markers)

or1 cx ^= 1

shl cx <<= 1

zero cx = 0

if_cz if cx==0 execute next instruction

sub_ab | sub_ac cx = ax – bx | ax = ax - cx

inc_a | inc_b | inc_c ax++ | bx++ | cx++

dec_c cx--

push_ax push ax on stack. (also bx cx dx versions)

pop_ax pop top of stack into ax. (also bx cx dx versions)

jmp move ip to template

jmpb move ip backward to template

call call a procedure

ret return from a procedure

mov_cd | mov_ab dx = cx | bx = ax

mov_iab move instruction at address in bx to address in ax

adr address of nearest template to ax

adrb search backward for template

adrf search forward for template

mal allocate memory for daughter cell

divide cell division

Page 16: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

16

Memory Allocation

The Tierran computer operates on a block of RAM of the real computer, referred to as the “soup”the “soup”.

The soup consisted of 60,000 bytes, which can hold 60,000 Tierran machine-instructions.

Each “creature” occupies some area in the soup.

Memory is circularMemory is circular.

Page 17: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

17

The Soup

Page 18: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

18

Cellularity

The cell membranecell membrane is defining its limits and preserving its structural integrity.

In digital organisms we need an analog to cell membraneanalog to cell membrane in order to prevent them from demolishing one another easily when they come into contact

Page 19: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

19

Cellularity (cont.)

Each Tierran creature has exclusive exclusive write privilegeswrite privileges within its own memory

A creature may examinemay examine the code of another creature, and even executeexecute it, but it can NOT overwritecan NOT overwrite it.

Page 20: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

20

Cellularity and Division

Creature has write privilegeswrite privileges to: The memory block it is born with (mother cellmother cell). The memory block it may allocate using malmal

instruction (daughter celldaughter cell), which may be used to grow or to reproduce into.

Upon creature dividedivide instruction: The mother cell loses write privilegesmother cell loses write privileges on

daughter cell’s. The daughter cell is given its own CPUdaughter cell is given its own CPU and

can allocate its own second memory block.

Page 21: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

21

The Slicer

Time sharing approximates parallelism. The number of instructions to be executed

in each slice may be set in proportion to in proportion to the size of the creaturethe size of the creature being executed, raised to a “slicer-powerslicer-power”.

The power determines if selection favors favors large or smalllarge or small creatures

• power < 1: favors small• power = 1: size neutral• power < 1: favors large

Page 22: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

22

Mortality - The Reaper

At birth, processes enter the bottomprocesses enter the bottom of the Reaper queueReaper queue.

When the memory is full, the Reaper kills kills processes at the topprocesses at the top of the queue.

Memory allocated to the dead process is reclaimed.

The code of a dead process is NOT removed from the soup.

Page 23: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

23

The Reaper (cont.)

When a process generates an errorerror, it moves one position up the Reaper queue.

SuccessfulSuccessful execution of dividedivide or malmal moves the process one position down.

Overall effect: Flown creatures rise to queue top and die.

Vigorous creatures have a greater longevity.

The probability of death increases with age.

Page 24: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

24

Mutations

Two kinds of mutations of machine instructions:

a single bitsingle bit of an instruction is flippedis flipped

random replacementsrandom replacements - the affected instruction is replaced by one of the 32 instructions in the set, chosen at random

Mutations occur when: a process is born

code is copied from place to place

any time at random (cosmic ray)

Page 25: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

25

Gene Splicing

There are three classes of splicing: CrossoverCrossover

InsertionInsertion

DeletionDeletion

Each class can occur in two ways: AnywhereAnywhere in the genome

Only at “segment boundariessegment boundaries”, marked by templates

Gene splicing is applied to a daughterapplied to a daughter process at the time of birthat the time of birth

Page 26: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

26

FlawsFlaws were originally conceived of as being

analogous to metabolic reactions gone wrong, or producing side products

Flaws are “intentional” errors in the errors in the operations of the machine instructionsoperations of the machine instructions

Most flaws are errors of magnitude + or – 1• Increment/decr may add/sub 2 or 0 instead of 1• Instructions shifting or rotating bits in registers may shift

the bits one place too much or too little

Page 27: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

27

Tierra SystemTierra System Self replicating individualsSelf replicating individuals

Genetic alterationsGenetic alterations

Natural selection Natural selection

Co-evolutionCo-evolutionResults

Page 28: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

28

1111find 0000 (start) -> bxfind 0001 (end) -> axcalculate size -> cx

Self-examination

save registers to stack1010

move [bx] -> [ax]decrement cx

if cx == 0 jump 0100increment ax & bx

jump 01011011

restore registersreturn1110

1101allocate daughter -> ax

call 0011 (copy procedure)cell divisionjump 0010

Reproduction Loop

Copy Procedure

1100

Ancestor 0080aaa

(coded by human)

Page 29: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

29

Page 30: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

30

1111find 0000 (start) -> bxfind 0001 (end) -> axcalculate size -> cx

save registers to stack1010

move [bx] -> [ax]decrement cx

if cx == 0 jump 0100increment ax & bx

jump 01011011

restore registersreturn1110

1101allocate daughter -> ax

call 0011 (copy procedure)cell divisionjump 0010

1100

Self-examination

Reproduction Loop

Copy Procedure

Ancestor 0080aaa

1100

Page 31: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

31

1111find 0000 (start) -> bxfind 0001 (end) -> axcalculate size -> cx

save registers to stack1010

move [bx] -> [ax]decrement cx

if cx == 0 jump 0100increment ax & bx

jump 01011011

restore registersreturn1110

1101allocate daughter -> ax

call 0011 (copy procedure)cell divisionjump 0010

1110

Self-examination

Reproduction Loop

Copy Procedure

Mutant

Page 32: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

32

1111find 0000 (start) -> bxfind 0001 (end) -> axcalculate size -> cx

1101allocate daughter -> ax

call 0011 (copy procedure)cell divisionjump 0010

1110

Self-examination

Reproduction Loop

Parasite 0045aaa

Page 33: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

33

Ancestor 0080aaa Self-exam

1111find 0000 (start) -> bxfind 0001 (end) -> axcalculate size -> cx

save registers to stack1010

move [bx] -> [ax]decrement cx

if cx == 0 jump 0100increment ax & bx

jump 01011011

restore registersreturn1110

1101allocate daughter -> ax

call 0011 (copy procedure)cell divisionjump 0010

Reproduction Loop

Copy Procedure1100

Self-exam1111

find 0000 (start) -> bxfind 0001 (end) -> axcalculate size -> cx

1101allocate daughter -> ax

call 0011 (copy procedure)cell divisionjump 0010

Reproduction Loop

1110

Parasite 0045aaa

Page 34: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

34

Page 35: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

35

Page 36: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

36

Page 37: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

37

Page 38: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

38

Page 39: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

39

0080gaiSelf-exam

1111find 0000 (start) -> bxfind 0001 (end) -> axcalculate size -> cx

1101allocate daughter -> ax

call 0011 (copy procedure)cell divisionjump 0010

Reproduction Loop

1110

Self-exam1111

find 0000 (start) -> bxfind 0001 (end) -> axcalculate size -> cx

1010move [bx] -> [ax]

decrement cxif cx == 0 jumpb 1100

increment ax & bxjumpb 0101

1110

allocate daughter -> axcall 0011 (copy procedure)

cell divisionjumpb 0000

Reproduction Loop

Copy Procedure1100

Parasite 0045aaa

Hyper Parasite!

Page 40: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

40

Page 41: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

41

??

0061acg Self-examination110find 001 (start) -> bxfind 000 (end) -> axcalculate size -> cx

1010move [bx] -> [ax]

decrement cxif cx == 0 jumpb 110increment ax & bx

jumpb 0101111

allocate daughter -> axcall 001 (copy procedure)

cell divisionjumpb 010

Reproduction Loop

Copy Procedure1100

1010move [bx] -> [ax]

decrement cxif cx == 0 jumpb 110increment ax & bx

jumpb 0101111

Social Hyper-parasite

Page 42: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

42

Other Results

ImmunityImmunity to parasites

Circumvention of immunityCircumvention of immunity to parasites

CheatersCheaters (e.g., 0027aab) Abuse the cooperation of social hyper-parasites

Novel forms of self examination

Optimization Size decreaseSize decrease Loop unrollingLoop unrolling

Emergence of EcologyEmergence of Ecology

Page 43: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

43

More Info

www.isd.atr.co.jp/~ray/tierra/index.html

It’s life Jim, but not as we know it (Dr. McCoy, Star Trek)

Page 44: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

44

Related Works

Network TierraNetwork Tierra (T. Ray) Connect many machines together to form a bigger “soup”.

“AvidaAvida” (Adami, Brown, 94), similar idea but On a grid (locality) I/O and (limited) ability to train organisms to perform

functions Active researchActive research

“AmoebaAmoeba” (Pargellis, 96), similar idea Simpler instruction set Spontaneous emergence of self-replicators

Page 45: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

45

Related Works (cont.)

“PhysisPhysis” (A. Egri-Nagy, ‘03) Evolves both: VM and programs Encodes the computer together with the program

“String Based TierraString Based Tierra” (K. Sigiura, ‘03) Encodes programs into stringsstrings Uses reg-exprreg-expr rules to match-and-substitute (to compute) Rules are strings as well Evolve programs and their rules as a single individual

Page 46: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

46

Open Challenges

Why creature complexity has stopped creature complexity has stopped increasingincreasing?

What’s limiting further development?

Over 10 years have passed: Memory space can support x10,000x10,000 bigger soup

CPUs can crunch x100x100 faster

In many cases “more is different” – is it here?

Page 47: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

47

Demos of Other Artificial-Life Works

Karl Sims

Demetri Terzopoulos

Page 48: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

48

Evolving Virtual Creatures Karl Sims ’94

Play

Page 49: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

49

Evolving a Swimmer

Go Fish

Jack Cousto

Evolving Artificial FishDemetri Terzopoulos ’94-’99

Page 50: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

50

Thank YouGood Luck

Page 51: 1 Digital Universes BARAK NAVEH, barnav Next >< Previous.

51

We will NOT try to do

Computer viruses and worms

Core Wars

Evolutionary simulations with artificial fitness and selection

Pre-biotic conditions from which life may emerge spontaneously