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

Preview:

Citation preview

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=<V,,P>

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-SystemAlphabet: {a,b}Words: {a,b,ab}Production Rules:

a abb a

(seed): bRecursion Depth 5

String Depth b 0 a 1 ab 2 aba 3 abaab 4abaababa 5

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

QuickTime™ and aTIFF (LZW) decompressor

are needed to see this picture.

n = 4 = 90

= -FP: F F+F-F-F+F

n = 2 = 90

= F-F-F-FP: F F+FF-FF-F-F+F+F

Jason Stredwick, MSU 2004

QuickTime™ and aTIFF (LZW) decompressor

are needed to see this picture.

n = 2 = 90

= F+F+F+FP: 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 12. + < > F Type 23. ++F < > F+F Type I

Jason Stredwick, MSU 2004

Context Sensitive ExampleSignal Propagation

: baaaaap1: b < a bp2: b a

baaaaaabaaaaaabaaaaaabaaaaaabaaaaaabaaaaaa

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

QuickTime™ and aTIFF (LZW) decompressor

are needed to see this picture.

n = 5 = 25.7

= FP: F F[+F]F [-F]F

n = 5 = 20

= FP: F F[+F]F [-F][F]

n = 4 = 22.5

= FP: F FF-[-F+F+F]+ [+F-F-F]

Jason Stredwick, MSU 2004

QuickTime™ and aTIFF (LZW) decompressor

are needed to see this picture.

n = 7 = 20

= XP: F FF X F[+X]F[-X]+X

n = 7 = 25.7

= XP: F FF X F[+X][-X]FX

n = 5 = 22.5

= XP: F FF X F-[[X]+X]+F [+FX]-X

Jason Stredwick, MSU 2004

QuickTime™ and aTIFF (LZW) decompressor

are needed to see this picture.

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 = <V, , , P> 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 Cp4: 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

QuickTime™ and aTIFF (LZW) decompressor

are needed to see this picture.

Jason Stredwick, MSU 2004

QuickTime™ and aTIFF (LZW) decompressor

are needed to see this picture.

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

ReferencesAlgorithmicbotany.com

Prusinkiewicz, P and Lindenmayer, A. The Algorithm Beauty of Plants, 1996

Hornby, Gregory S. and Pollack, Jordan B. (2001). The advantagesof Generative Grammatical Encodings for Physical Design

Hornby, Gregory S. and Pollack, Jordan B. (2001). Body-BrainCo-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 PhysicalRobots

Hornby, Gregory S. and Pollack, Jordan B. (2001). Evolving L-Systems to Generate Virtual Creatures

Recommended