# Jason Stredwick, MSU 2004 L-Systems Lindenmayer Systems algorithmicbotany.org.

## Presentation on theme: "Jason Stredwick, MSU 2004 L-Systems Lindenmayer Systems algorithmicbotany.org."— Presentation transcript:

Jason Stredwick, MSU 2004 L-Systems Lindenmayer Systems algorithmicbotany.org

Jason Stredwick, MSU 2004 L-System Overview Goals (Plant modeling) –Structural –Developmental –Chemical Parallel replacement grammar Representative of multicellular growth

Jason Stredwick, MSU 2004 Overview Continued Other types of parallel replacement systems –Open polygon by Koch –Cellular automata by Wolfram –Game of Life by Conway L-System grammar interpretations –LOGO (graphical modeling of plants) –Pure math –Jordan Pollack’s Golem project

Jason Stredwick, MSU 2004 D0L-System Notation 0 stands for context free D stands for deterministic V is the alphabet V * is the set of all words over V V + is V * excluding the empty word  is the word in V + that is the seed of the system, called the axiom P is the set of production rules, explained later 0L-System is defined as G=

Jason Stredwick, MSU 2004 D0L-System Product Rules Production rule is defined as P  V x V * Alternate notation ( ,  ) or     is called the predecessor  is called the successor  can only be a single character  can be any word, which includes letters If no production rule is given for a predecessor, it is assumed to be   

Jason Stredwick, MSU 2004 Determinism A system is considered deterministic if and only if for each predecessor, , there exists exactly one production rule, or more simply each letter in the alphabet can map to exactly one word in V *.

Jason Stredwick, MSU 2004 Example: D0L-System Alphabet:{a,b} Words:{a,b,ab} Production Rules: a  ab b  a  (seed):b Recursion Depth5 String Depth b0 a1 ab2 aba3 abaab4 abaababa5

Jason Stredwick, MSU 2004 LOGO Language Used to graphically model plants F move forward while drawing a line f move forward without drawing a line + rotate left - rotate right 3-D instructions are also available, using Euler rotations

Jason Stredwick, MSU 2004 n = 4  = 90   = -F P: F  F+F-F-F+F n = 2  = 90   = F-F-F-F P: F  F+FF-FF-F-F+F+F

Jason Stredwick, MSU 2004 n = 2  = 90   = F+F+F+F P: F  F+f-FF+F+FF+Ff+FF-f+FF-F-FF-Ff-FFF f  ffffff

Jason Stredwick, MSU 2004 Context Sensitive L-System Non-deterministic Types: 1, 2, and I, written 2L-System Uses neighbor information as a condition to use a production rule > Right of predecessor < Left of predecessor Example: 1.  > F   Type 1 2. + F   Type 2 3.++F F+F   Type I

Jason Stredwick, MSU 2004 Context Sensitive Example Signal Propagation  :baaaaa p1:b < a  b p2: b  a baaaaa abaaaa aabaaa aaabaa aaaaba aaaaab aaaaaa

Jason Stredwick, MSU 2004 Non-deterministic Each predecessor,  –Multiple production rules –Each rule has a probability of use –Probabilities must sum to one Example:   F   FF   FFF Stochastic L-System 0.1 0.2 0.7

Jason Stredwick, MSU 2004 Bracketed L-System [ push current state onto a stack ] pop current state onto a stack Used to create tree like structures

Jason Stredwick, MSU 2004 n = 5  = 25.7   = F P: F  F[+F]F [-F]F n = 5  = 20   = F P: F  F[+F]F [-F][F] n = 4  = 22.5   = F P: F  FF-[-F+F+F]+ [+F-F-F]

Jason Stredwick, MSU 2004 n = 7  = 20   = X P: F  FF X  F[+X]F[-X]+X n = 7  = 25.7   = X P: F  FF X  F[+X][-X]FX n = 5  = 22.5   = X P: F  FF X  F-[[X]+X]+F [+FX]-X

Jason Stredwick, MSU 2004

Parameterized L-System V is the alphabet  is the set of formal parameters, , real numbers  is the axiom, seed, (V x  * ) + E(  ) represent math operations C(  ) represent logic operations, conditional  is the predecessor, (V x  * )  is the successor, (V x E(  )) * P   x C(  ) x  G = defines a parametric 0L-System

Jason Stredwick, MSU 2004 Parameterized 0L-System Example  : B(2)A(4,4) p1:A(x,y) : y<=3  A(x*2, x+y) p2:A(x,y) : y>3  B(x)A(x/y, 0) p3:B(x) : x<1  C p4:B(x) : x>=1  B(x-1) B(2)A(4,4) B(1)B(4)A(1,0) B(0)B(3)A(2,1) CB(2)A(4,3) CB(1)A(8,7) CB(0)B(8)A(1,0)

Jason Stredwick, MSU 2004

Hornby/Pollack Multiple applications Considers there system generic by simply replacing the alphabet. Uses Parameterized Bracketed D0L-System Constrain conditions to compare with a constant Additional feature: {…}(n) block repeat

Jason Stredwick, MSU 2004 Table Language Forward(n) Backward(n) Up(n) Down(n) Left(n) Right(n) Clockwise(n) Counter-clockwise(n) [ ] { block }(n) [{[forward(6)]left(1)}(4)] up(1)forward(3)down(1) [{[forward(4.5)]left(1)}(4)]

Jason Stredwick, MSU 2004 Neural Network Language decrease-weight(n) duplicate(n) increase-weight(n) loop(n) merge(n) next(n) output(n) parent(n) reverse(n) set-function(n)

Jason Stredwick, MSU 2004 Mutation Original: P0(n0, n1) : n0 > 5.0  { a(1.0)b(2.0) }(n1) n0 > 2.0  [ P1(n1 - 1.0, n0 / 2.0) ] Mutate condition: P0(n0, n1) : n0 > 7.0  { a(1.0)b(2.0) }(n1) n0 > 2.0  [ P1(n1 - 1.0, n0 / 2.0) ] Mutate arguement: P0(n0, n1) : n0 > 5.0  { a(1.0)b(2.0) }(n1) n0 > 2.0  [ P1(n1 - 2.0, n0/2.0) ]

Jason Stredwick, MSU 2004 Mutation Original: P0(n0, n1) : n0 > 5.0  { a(1.0)b(2.0) }(n1) n0 > 2.0  [ P1(n1 - 1.0, n0 / 2.0) ] Mutate symbol: P0(n0, n1) : n0 > 7.0  { c(1.0)b(2.0) }(n1) n0 > 2.0  [ P1(n1 - 1.0, n0 / 2.0) ] Mutate random symbol (removed b(2.0)): P0(n0, n1) : n0 > 5.0  { a(1.0) }(n1) n0 > 2.0  [ P1(n1 - 2.0, n0/2.0) ]

Jason Stredwick, MSU 2004 Mutation Original: P0(n0, n1) : n0 > 5.0  { a(1.0)b(2.0) }(n1) n0 > 2.0  [ P1(n1 - 1.0, n0 / 2.0) ] Insert random symbol: P0(n0, n1) : n0 > 7.0  { a(1.0)b(2.0) }(n1)c(3.0) n0 > 2.0  [ P1(n1 - 1.0, n0 / 2.0) ] Encapsulate a block of characters: P0(n0, n1) : n0 > 5.0  { P2(n0, n1) }(n1) n0 > 2.0  [ P1(n1 - 2.0, n0/2.0) ] P2(n0, n1) : n0 > 5.0  a(1.0)b(2.0) n0 > 2.0  a(1.0)b(2.0)

Jason Stredwick, MSU 2004 Recombination Original: P3(n0, n1) : n0 > 5.0  { a(1.0)b(2.0) }(n1) n0 > 2.0  [ P1(n1 - 1.0, n0 / 2.0) ] P3(n0, n1) : n0 > 3.0  b(3.0)a(2.0) n0 > 1.0  P1(n1 - 1.0, n0 - 2.0) Replace condition-successor pair P3(n0, n1) : n1 > 3.0  b(3.0)a(2.0) n0 > 2.0  [ P1(n1 - 1.0, n0 / 2.0) ]

Jason Stredwick, MSU 2004 Recombination Original: P3(n0, n1) : n0 > 5.0  { a(1.0)b(2.0) }(n1) n0 > 2.0  [ P1(n1 - 1.0, n0 / 2.0) ] P3(n0, n1) : n0 > 3.0  b(3.0)a(2.0) n0 > 1.0  P1(n1 - 1.0, n0 - 2.0) Replace successor P3(n0, n1) : n1 > 3.0  b(3.0)a(2.0) n0 > 2.0  P1(n1 - 1.0, n1 - 2.0)

Jason Stredwick, MSU 2004 Recombination Original: P3(n0, n1) : n0 > 5.0  { a(1.0)b(2.0) }(n1) n0 > 2.0  [ P1(n1 - 1.0, n0 / 2.0) ] P3(n0, n1) : n0 > 3.0  b(3.0)a(2.0) n0 > 1.0  P1(n1 - 1.0, n0 - 2.0) Replace one block with another P3(n0, n1) : n1 > 3.0  b(3.0)a(2.0) n0 > 2.0  [ b(3.0)a(2.0) ]

Jason Stredwick, MSU 2004 References Algorithmicbotany.com Prusinkiewicz, P and Lindenmayer, A. The Algorithm Beauty of Plants, 1996 Hornby, Gregory S. and Pollack, Jordan B. (2001). The advantages of Generative Grammatical Encodings for Physical Design Hornby, Gregory S. and Pollack, Jordan B. (2001). Body-Brain Co-evolution Using L-systems as a Generative Encoding Hornby, Gregory S., Lipson, Hod, and Pollack, Jordan B. (2001). Evolution of Generative Design Systems for Modular Physical Robots Hornby, Gregory S. and Pollack, Jordan B. (2001). Evolving L-Systems to Generate Virtual Creatures