Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners University of Göttingen, 27 February, 2012 Winfried Kurth Introduction to.

Slides:



Advertisements
Similar presentations
ICE1341 Programming Languages Spring 2005 Lecture #6 Lecture #6 In-Young Ko iko.AT. icu.ac.kr iko.AT. icu.ac.kr Information and Communications University.
Advertisements

C O N T E X T - F R E E LANGUAGES ( use a grammar to describe a language) 1.
Chapter 8 High-Level Programming Languages. 8-2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
Introduction to Programming Languages Nai-Wei Lin Department of Computer Science and Information Engineering National Chung Cheng University.
Modelling of Ecosystems by Tools from Computer Science Summer School at Czech University of Life Sciences, Prague, September, 2013 Winfried Kurth.
Programming Languages Marjan Sirjani 2 2. Language Design Issues Design to Run efficiently : early languages Easy to write correctly : new languages.
ATEC Procedural Animation Introduction to Procedural Methods in 3D Computer Animation Dr. Midori Kitagawa.
L-System Aristid Lindenmayer (1968), biologist. L-System A method of constructing a FRACTAL that is also a MODEL for plant growth. The Computational Beauty.
Turing Machines (At last!). Designing Universal Computational Devices Was Not The Only Contribution from Alan Turing… Enter the year 1940: The world is.
Programming Languages Language Design Issues Why study programming languages Language development Software architectures Design goals Attributes of a good.
L-systems Presented by Luv Kohli COMP258 October 30, 2002 Images copyright © 1992 D. Fowler, P. Prusinkiewicz, and J. Battjes.
Overview of Programming Paradigms
1 ) Definition 2) Note on structured and modular programming, and information hiding 3) Example imperative languages 4) Features of imperative languages.
Programming Languages Structure
Chapter 8 High-Level Programming Languages Nell Dale John Lewis.
Elementary Data Types Scalar Data Types Numerical Data Types Other
CS39N The Beauty and Joy of Computing Lecture #11 Recursion III It has been a challenge to power electronic components implanted within a body.
IlliDOL: A Framework for Exploration of L- Systems in Three Dimensions Vilas Dhar Math 198 Spring 2003.
XL as an extension of the L-system formalism Tutorial "Modelling Plants with GroIMP", Cottbus, March 11-12, 2008 Winfried Kurth Ole Kniemeyer Reinhard.
Syntax & Semantic Introduction Organization of Language Description Abstract Syntax Formal Syntax The Way of Writing Grammars Formal Semantic.
Chapter 8 High-Level Programming Languages (modified by Erin Chambers)
High-Level Programming Languages: C++
(1.1) COEN 171 Programming Languages Winter 2000 Ron Danielson.
Summer School „Modelling and Simulation with GroIMP“ / Tutorial for beginners University of Göttingen (Germany), September, 2010 Winfried Kurth Some.
Tutorial „Modelling in the language XL“ University of Göttingen (Germany), September 21/22, 2009 Winfried Kurth Some basic examples in XL (part 1) related.
CSC3315 (Spring 2009)1 CSC 3315 Programming Languages Hamid Harroud School of Science and Engineering, Akhawayn University
Modelling of Ecosystems by Tools from Computer Science Summer School at Czech University of Life Sciences, Prague, September, 2013 Winfried Kurth.
Functional-Structural Plant Modelling with GroIMP and XL
School of Computer Science & Information Technology G6DICP - Lecture 22 The Theory of Object Oriented Programming.
COP 4620 / 5625 Programming Language Translation / Compiler Writing Fall 2003 Lecture 10, 10/30/2003 Prof. Roy Levow.
L-Systems and Procedural Plants CSE 3541 Matt Boggus.
CS 326 Programming Languages, Concepts and Implementation Instructor: Mircea Nicolescu Lecture 2.
The Artificial Life of Plants Przemyslaw Prusinkiewicz, Mark Hammel, Radom´ır Mˇech Department of Computer Science University of Calgary Calgary, Alberta,
Copyright © 2006 Addison-Wesley. All rights reserved.1-1 ICS 410: Programming Languages.
Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners University of Göttingen, 27 February, 2012 Winfried Kurth Basic examples.
Chapter 8 High-Level Programming Languages. 8-2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
Summer School „Modelling and Simulation with GroIMP“ / Tutorial for beginners University of Göttingen (Germany), September, 2010 Winfried Kurth Some.
Lindenmayer systems Martijn van den Heuvel May 26th, May 26th, 2011.
How to Draw a Tree L-Systems in Computer Graphics Steven Janke.
Summer School „Modelling and Simulation with GroIMP“ / Tutorial for beginners University of Göttingen (Germany), September, 2010 Winfried Kurth Some.
Functional-Structural Plant Modelling with GroIMP and XL Tutorial and Workshop at Agrocampus Ouest, Angers, 5-7 May, 2015 Winfried Kurth University of.
Summer School „Modelling and Simulation with GroIMP“ / Tutorial for beginners University of Göttingen (Germany), September, 2010 Winfried Kurth Some.
Functional-Structural Plant Modelling with GroIMP and XL Tutorial and Workshop at Agrocampus Ouest, Angers, 5-7 May, 2015 Winfried Kurth University of.
Modelling of Ecosystems by Tools from Computer Science Summer School at Czech University of Life Sciences, Prague, September, 2013 Winfried Kurth.
ProgrammingLanguages Programming Languages Language Definition, Translation and Design.
LINDFERN Lindenmayer Systems in VPython Nick Langhammer.
Theory of Programming Languages Introduction. What is a Programming Language? John von Neumann (1940’s) –Stored program concept –CPU actions determined.
Graph-oriented modelling of multiscaled dynamical systems with a dynamical structure: Challenges to the "Relational Growth Grammar" approach Winfried Kurth.
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
ATEC Procedural Animation Introduction to Procedural Methods in 3D Computer Animation Dr. Midori Kitagawa.
ECE 8443 – Pattern Recognition ECE 8527 – Introduction to Machine Learning and Pattern Recognition Objectives: Elements of a Discrete Model Evaluation.
Course14 Dynamic Vision. Biological vision can cope with changing world Moving and changing objects Change illumination Change View-point.
Experimenting with Grammars to Generate L-Systems October 29, 2007
CPS120: Introduction to Computer Science Variables and Constants.
Modelling of Ecosystems by Tools from Computer Science Summer School at Czech University of Life Sciences, Prague, September, 2013 Winfried Kurth.
Tutorial „Modelling in the language XL“ University of Göttingen (Germany), September 21/22, 2009 Winfried Kurth Some basic examples in XL (part 2) related.
Functional-Structural Plant Modelling with GroIMP and XL Tutorial and Workshop at Agrocampus Ouest, Angers, 5-7 May, 2015 Winfried Kurth University of.
Onlinedeeneislam.blogspot.com1 Design and Analysis of Algorithms Slide # 1 Download From
Experimenting with Grammars to Generate L-Systems – in JFLAP March 31, 2011 Prof. Susan Rodger Computer Science Dept.
Grammars, L-Systems Jim Whitehead UC Santa Cruz School of Engineering courses.soe.ucsc.edu/courses/cmps265/Spring14/01 23 Apr 2014.
Computer Organization and Architecture Lecture 1 : Introduction
Programming paradigms
Information Science and Engineering
L-systems L-systems are grammatical systems introduced by Lyndenmayer to describe biological developments such as the growth of plants and cellular organisms.
ATCM 3310 Procedural Animation
Turing Machines (At last!).
Interpretive rules and instantiation rules
Analysis models and design models
High Level Programming Languages
Principles of Programming Languages
Presentation transcript:

Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners University of Göttingen, 27 February, 2012 Winfried Kurth Introduction to rule-based programming, L-systems and XL

Motivation Functional-structural plant models (FSPM) „model triangle“: Linking of botanical structures and functions (e.g., light interception, water flow) in a coherent, single model processes linked to morphological objects statistics aggregated models structural models morphology process models physiology functional-structural models

Structural models 3 levels: 1.static description of structure plant at a fixed date (e.g., at 27 September 2011) 2.dynamic description of structure, non-sensitive description of development (ontogenesis) of a plant: time series of 3-dimensional structures 3.dynamics, taking causal impacts / conditions into account (sensitive models) different paths of development logical conditions for the decision between them (simplest case: stochastic)

concerning 1.: static description of structure two approaches: (a)tables each morphological unit of a plant = one row dtd code = „descriptive tree data“, or mtg code (b) imperative (command-driven): „Turtle geometry“ virtual turtle „constructs“ the structure, the description are the commands which control it turtle geometry command language

The second level of description: Dynamic description of plant structures how do plants change during ontogenesis?

The approach of AMAP Atelier de Modélisation de l‘Architecture des Plantes Montpellier, Paris, Beijing (LIAMA) Ph. de Reffye, R. Lecoustre, M. Jaeger, E. Costes, P. Dinouard, F. Blaise, P.-H. Cournède et al. (agronomists, computer scientists, botanists, mathematicians) Modelling the activity of meristems shape of tree = trajectory of its meristems

approach for modelling: shape of tree = trajectory of meristems primary meristem branching secondary meristem (to be added: mechanic deformations, deformations with physiological causes, damages, processes of senescence and mortality)

meristem-based modelling approach Adrian D. Bell 1979: 3 basic processes - formation of a shoot (growth) - transition to resting state (and new activation) - death similarly de Reffye 1981: 3 meristem states - dormance (sleeping) - croissance (growth) - mortalité (death) state transitions with probabilities  binomial distribution, Markov chains

The software GroIMP „Growth-grammar related Interactive Modelling Platform“ download from Sourceforge (free & open source) rgg files, projects (gsz files) editor, environment for development window for 3-d view 2-d (graph) window (usually hidden!) attribute view for each object camera position navigation interactive modelling compiler for the programming language XL framework for solving ODEs in the context of plant models

XL: a multi-paradigm language Robert Floyd 1978: Turing Award Lecture "The Paradigms of Programming" Robert W. Floyd ( )

Ecosystem: organisms behaviour (under certain conditions) processes describe structure determine laws (rules) controlling behaviour calculate effects

Some important paradigms of programming -for numerical simulation of processes: imperative paradigm (also: von-Neumann paradigm, control flow paradigm) John von Neumann ( )

imperative programming: computer = machine for the manipulation of values of variables (these manipulations can have side effects).

programme = plan for the calculation process with specification of the commands and of the control flow (e.g. loops). example: x = 0; while (x < 100) x = x + 1;

programming languages which support imperative programming: Fortran, Pascal, C,..., parts of Java,..., command language of turtle geometry

Turtle: goes according to commands

F0

F0 RU(90)

F0 RU(90) F0

F0 RU(90) F0 RU(90) LMul(0.5) F0

object-oriented paradigm computer = environment for virtual objects programme = list of (object) classes, i.e. general specifications of objects, which can be created and destroyed at runtime. programming languages: Smalltalk, Simula, C++, Java,...

Inheritance of attributes and methods from superclasses to subclasses example: public class Car extends Vehicle { public String name; public int places; public void show() { System.out.println("The car is a " + name); System.out.println("It has " + places + "places."); } typical: classes ( Car ) with data ( name, places ) and methods ( show )

usefulness of object hierarchies in biology for example: organ leafflowerinternoderoot segment broad leaf needlecoarse r.s. fine r.s.

rule-based paradigm computer = machine transforming structures There is a current structure (in XL: a graph) which is transformed as long as it is possible. Work process: search and application. matching: search for a suitable rule, rewriting: application of the rule, thereby transformation of the structure. programme = set of transformation rules to find a programme: specification of rules. programming languages: L-system languages, AI languages, Prolog,...

Example: a graph grammar rule:

Example: a graph grammar rule: application:

rule systems for the replacement of character strings in each derivation step parallel replacement of all characters for which there is one applicable rule by A. Lindenmayer (botanist) introduced in 1968 to model growth of filamentous algae L-systems (Lindenmayer systems) Aristid Lindenmayer ( ) Dynamical description of structures

L-systems mathematically: a triple ( , , R) with:  a set of characters, the alphabet,  a string with characters from , the start word (also "Axiom"), R a set of rules of the form character  string of characters; with the characters taken from .

A derivation step (rewriting) of a string consists of the replacement of all of its characters which occur in left-hand sides of rules by the corresponding right-hand sides. Convention: characters for which no rule is applicable stay as they are. Result: Derivation chain of strings, developed from the start word by iterated rewriting.    1   2   3 ....

Example: alphabet {A, B}, start word A set of rules: A  B B  AB A

Example: alphabet {A, B}, start word A set of rules: A  B B  AB B

Example: alphabet {A, B}, start word A set of rules: A  B B  AB AB parallel replacement

Example: alphabet {A, B}, start word A set of rules: A  B B  AB BAB

Example: alphabet {A, B}, start word A set of rules: A  B B  AB BAB

Example: alphabet {A, B}, start word A set of rules: A  B B  AB ABBAB

Example: alphabet {A, B}, start word A set of rules: A  B B  AB derivation chain: A  B  AB  BAB  ABBAB  BABABBAB  ABBABBABABBAB  BABABBABABBABBABABBAB ...

still missing for modelling biological structures in space: a geometrical interpretation Thus we add: a function which assigns to each string a subset of 3-D space „interpreted“ L-system processing    1   2   3 ....    S 1 S 2 S S 1, S 2, S 3,... can be seen as developmental steps of an object, a scene or an organism.

For the interpretation: turtle geometry the turtle command set becomes a subset of the character set of the L-system. Symbols which are not turtle commands are ignored by the turtle.  connection with imperative paradigm

imperativeobject orientedrule based Java XL XL: a synthesis of three paradigms „eXtended L-system language“ programming language which makes parallel graph- grammars (RGG) accessible in a simple way

F0 RU(90) F0 RU(90) LMul(0.5) F0 turtle geometry

Turtle geometry „turtle": virtual device for drawing or construction in 2-D or 3-D space - able to store information (graphical and non- graphical) - equipped with a memory containing state information (important for branch construction) - current turtle state contains e.g. current line thickness, step length, colour, further properties of the object which is constructed next

Turtle commands in XL (selection): F0 "Forward", with construction of an element (line segment, shoot, internode...), uses as length the current step size (the zero stands for „no explicit specification of length") M0 forward without construction (Move) L(x) change current step size (length) to x LAdd(x) increment the current step size to x LMul(x) multiply the current step size by x D(x), DAdd(x), DMul(x) analogously for current thickness

Repetition of substrings possible with " for " e.g., for ((1:3)) ( A B C ) yields A B C A B C A B C what is the result of the interpretation of L(10) for ((1:6)) ( F0 RU(90) LMul(0.8) ) ?

L(10) for ((1:6)) ( F0 RU(90) LMul(0.8) )

further example: for ((1:20)) ( for ((1:36)) ( F0 RU(165) F0 RU(165) ) RU(270) )

further example: for ((1:20)) ( for ((1:36)) ( F0 RU(165) F0 RU(165) ) RU(270) )

Extension to 3-D graphics: turtle rotations by 3 axes in space

head left up Extension to 3-D graphics: turtle rotations by 3 axes in space

RH RL RU Extension to 3-D graphics: turtle rotations by 3 axes in space

3-D commands: RU(45) rotation of the turtle around the "up " axis by 45° RL(... ), RH(... ) analogously by "left" and "head" axis up-, left- and head axis form an orthogonal spatial coordinate system which is carried by the turtle RV(x) rotation "to the ground" with strength given by x RG rotation absolutely to the ground (direction (0, 0, -1))

Example: L(100) D(3) RU(-90) F(50) RU(90) M0 RU(90) D(10) F0 F0 D(3) RU(90) F0 F0 RU(90) F(150) RU(90) F(140) RU(90) M(30) F(30) M(30) F(30) RU(120) M0 Sphere(15) generates

Branches: realization with memory commands [ put current state on stack ("Ablage", Stack) ] take current state from stack and let it become the current state (thus: end of branch!) F0 [ RU(-20) F0 ] RU(20) DMul(2) F0

How to execute a turtle command sequence with GroIMP write into a GroIMP project file (or into a file with filename extension.rgg ): protected void init() [ Axiom ==> turtle command sequence ; ]

Example: Drawing a triangle protected void init() [ Axiom ==> RU(30) F(10) RU(120) F(10) RU(120) F(10) ] see file sm09_e01.rgg