View
217
Download
1
Tags:
Embed Size (px)
Citation preview
1
Digital Universes
BARAK NAVEH, www.cs.bgu.ac.il/~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.
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.
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.
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?
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
7
Tom Ray’s Tierra Project
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.
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.
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
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.
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.
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
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.
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
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.
17
The Soup
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
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.
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.
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
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.
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.
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)
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
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
27
Tierra SystemTierra System Self replicating individualsSelf replicating individuals
Genetic alterationsGenetic alterations
Natural selection Natural selection
Co-evolutionCo-evolutionResults
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)
29
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
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
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
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
34
35
36
37
38
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!
40
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
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
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)
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
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
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?
47
Demos of Other Artificial-Life Works
Karl Sims
Demetri Terzopoulos
48
Evolving Virtual Creatures Karl Sims ’94
Play
49
Evolving a Swimmer
Go Fish
Jack Cousto
Evolving Artificial FishDemetri Terzopoulos ’94-’99
50
Thank YouGood Luck
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