Adding functionality to a growth model; A tutorial on queries in GroImp Basic plant.gsz Adding function using queries.

Slides:



Advertisements
Similar presentations
Sequence of characters Generalized form Expresses Pattern of strings in a Generalized notation.
Advertisements

Compiler construction in4020 – lecture 2 Koen Langendoen Delft University of Technology The Netherlands.
Lex -- a Lexical Analyzer Generator (by M.E. Lesk and Eric. Schmidt) –Given tokens specified as regular expressions, Lex automatically generates a routine.
Some Properties of SSA Mooly Sagiv. Outline Why is it called Static Single Assignment form What does it buy us? How much does it cost us? Open questions.
CS-1010 Dr. Mark L. Hornick 1 Selection Statements and conditional expressions.
1 Operational Semantics Mooly Sagiv Tel Aviv University Textbook: Semantics with Applications.
CPSC 322, Lecture 12Slide 1 CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12 (Textbook Chpt ) January, 29, 2010.
1 Control Flow Analysis Mooly Sagiv Tel Aviv University Textbook Chapter 3
Shoots I. Primary growth in stems A. Shoot system 1. apical bud 2. apical meristem activity B. Nodes and internodes C. 3 basic leaf arrangements D. Fate.
LPT for Data Aggregation in Wireless Sensor networks Marc Lee and Vincent W.S Wong Department of Electrical and Computer Engineering, University of British.
Cs164 Prof. Bodik, Fall Symbol Tables and Static Checks Lecture 14.
CS 146: Data Structures and Algorithms June 18 Class Meeting Department of Computer Science San Jose State University Summer 2015 Instructor: Ron Mak
Software Testing Sudipto Ghosh CS 406 Fall 99 November 9, 1999.
Summer School „Modelling and Simulation with GroIMP“ / Tutorial for beginners University of Göttingen (Germany), September, 2010 Winfried Kurth Modelling.
Functional-Structural Plant Modelling with GroIMP and XL Tutorial and Workshop at Agrocampus Ouest, Angers, 5-7 May, 2015 Winfried Kurth University of.
Lecture Objectives  To learn how to use a tree to represent a hierarchical organization of information  To learn how to use recursion to process trees.
Secure Web Applications via Automatic Partitioning Stephen Chong, Jed Liu, Andrew C. Meyers, Xin Qi, K. Vikram, Lantian Zheng, Xin Zheng. Cornell University.
Dijkstras Algorithm Named after its discoverer, Dutch computer scientist Edsger Dijkstra, is an algorithm that solves the single-source shortest path problem.
Summer School „Modelling and Simulation with GroIMP“ / Tutorial for beginners University of Göttingen (Germany), September, 2010 Winfried Kurth Some.
Modelling of Ecosystems by Tools from Computer Science Summer School at Czech University of Life Sciences, Prague, September, 2013 Winfried Kurth.
FUNCTIONS. Function call: >>> type(32) The name of the function is type. The expression in parentheses is called the argument of the function. Built-in.
® Microsoft Access 2010 Tutorial 5 Creating Advanced Queries and Enhancing Table Design.
Compiler Phases: Source program Lexical analyzer Syntax analyzer Semantic analyzer Machine-independent code improvement Target code generation Machine-specific.
Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners University of Göttingen, 27 February, 2012 Winfried Kurth Basic examples.
Automating Construction of Lexers. Example in javacc TOKEN: { ( | | "_")* > | ( )* > | } SKIP: { " " | "\n" | "\t" } --> get automatically generated code.
PART I: overview material
BUILDING JAVA PROGRAMS CHAPTER 7 Arrays. Exam #2: Chapters 1-6 Thursday Dec. 4th.
Spring 2008 Mark Fontenot CSE 1341 Principles of Computer Science I Note Set 3.
Summer School „Modelling and Simulation with GroIMP“ / Tutorial for beginners University of Göttingen (Germany), September, 2010 Winfried Kurth Some.
Lexical Analysis I Specifying Tokens Lecture 2 CS 4318/5531 Spring 2010 Apan Qasem Texas State University *some slides adopted from Cooper and Torczon.
Stems and Plant Growth Basics. Shoots vs. Roots Stems are part of the shoot system (stems, leaves, flowers) The shoot system depends on the roots for.
Summer School „Modelling and Simulation with GroIMP“ / Tutorial for beginners University of Göttingen (Germany), September, 2010 Winfried Kurth Some.
1 10/27/ :26 UML Simplicity in Complexity. 2 10/27/ :26 UML Rewriting Systems Classic Example: Koch 1905 Initiator Generator.
White-box Testing.
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.
Static Methods. 2 Objectives Look at how to build static (class) methods Study use of methods calling, parameters, returning values Contrast reference.
Ch. 10 For Statement Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2012.
COM S 207 Method Instructor: Ying Cai Department of Computer Science Iowa State University
Lesson 6 Selection Structures. Example program //This will convert a numeric grade into a letter grade import TerminalIO.KeyboardReader; public class.
CSS446 Spring 2014 Nan Wang.  To understand the implementation of linked lists and array lists  To analyze the efficiency of fundamental operations.
ICS312 LEX Set 25. LEX Lex is a program that generates lexical analyzers Converting the source code into the symbols (tokens) is the work of the C program.
Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners University of Göttingen, 27 February, 2012 Gerhard Buck-Sorlin and Winfried.
® Microsoft Access 2010 Tutorial 5 Creating Advanced Queries and Enhancing Table Design.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 1 Extracting Sequence.
Boolean expressions, part 1: Compare operators. Compare operators Compare operators compare 2 numerical values and return a Boolean (logical) value A.
Modelling of Ecosystems by Tools from Computer Science Summer School at Czech University of Life Sciences, Prague, September, 2013 Winfried Kurth.
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.
NETWORK FLOWS Shruti Aggrawal Preeti Palkar. Requirements 1.Implement the Ford-Fulkerson algorithm for computing network flow in bipartite graphs. 2.For.
Overview of Previous Lesson(s) Over View  A token is a pair consisting of a token name and an optional attribute value.  A pattern is a description.
Cyclomatic Complexity Philippe CHARMAN Last update:
LECTURE 5 Scanning. SYNTAX ANALYSIS We know from our previous lectures that the process of verifying the syntax of the program is performed in two stages:
Java Generics. Lecture Objectives To understand the objective of generic programming To be able to implement generic classes and methods To know the limitations.
Programming what is C++
Review 1.
Finite State Machines Dr K R Bond 2009
CS 3304 Comparative Languages
Basic Data Structures.
Lesson Domain and Range: Let’s use proper notation
More Graph Algorithms.
Apical Cytokinin mitosis leaf node Auxin cell elongation.
Interpretive rules and instantiation rules
Copyright © Cengage Learning. All rights reserved.
Dr. Fowler  CCM Functions.
int [] scores = new int [10];
Lecture 9 CS2013.
Introduction to Computer Science
1 Lecture 10 CS2013.
Presentation transcript:

Adding functionality to a growth model; A tutorial on queries in GroImp Basic plant.gsz Adding function using queries

What is a query A query specifies a pattern and at run-time it finds all instances of that pattern m:Meristem ==> Internode [Leaf] m; m:Meristem, (m.rank>Flowering) ==> Flower; m:Meristem,(*p:Plantbase*),(p.flower) ==> Flower; Plantbase is marked as context, meaning it is not altered by the code but must be present for the rule to match.

Basic plant.gsz Simple growth model Plantbase, Meristem, Leaf, Internode Light model Direct and Diffuse Light interception by the plant PAR, red, farred

Leaf plasticity – Modules.rgg

Leaf plasticity

Implement the Plasticity() method void update() { Plasticity();... } void update() { //Plasticity();... } To turn off leaf plasticity, simply add // to skip running the Plasticity() method

Testing the result of Leaf Plasticity module Plantbase { int ID double sumabs; void output() { double L = sum((*l:Leaf, (l.ID==ID)*)[abs]); sumabs += L; } Iteration target Iteration expression Query - Finds all instances of Leaf whose value of ID matches the ID of Plantbase value

Aggregate methods - values A query is a generator expression, an aggregate method is a consumer expression that takes a sequence of values as input and returns a single value. sum()sum of listed values prod()product of listed values mean()mean of listed values count()counts the number of listed values max()returns the highest listed value min()return the lowest listed value

Testing the result of Leaf Plasticity module Plantbase {... void output() {... double pet = mean((*l:Leaf, (l.ID==ID)*)[PetLength]); double lw = sum((*l:Leaf, (l.ID==ID)*)[length])/ sum((*l:Leaf, (l.ID==ID)*)[width]); }

Testing the result of Leaf Plasticity module Plantbase {... void output() {... println(“cumulative abs = “ + sumabs); println(“mean pet length = “ + pet); println(“mean lw ratio = “ + lw); }

Testing the result of Leaf Plasticity Run two 60 day simulations, one with and one without plasticity, and compare the output. cumulative abs = 15204cumulative abs = mean pet length = 0.089mean pet length = l/w ratio = 2.024l/w ratio = 2.22

Branching plant Parameters.rgg... const int MaxOrder = 1;... static double wmax_I = 0.2;...

Pipe model

Each internode needs information from other internodes upwards in the plant architecture. Internode rank

Graph Panels -> 2D -> Graph Nodes Edges

Graph – Develop.rgg m:Meristem, (m.newPhytomerAllowed()) ==> i:Internode.(length=0) [ l:Leaf ] if(m.order+1<=MaxOrder) ( [ RL() RH() am:Meristem ] ) RH(137.5) m.(rank++) ;

Graph

Edge notations Edge type:Number of Edges: -->Any Edge()+1-n >Successor Edge()*0-n +>Branch Edge()?0-1 (){a}a Direction:(){a,b}a-b --Any direction(){a,}a-n Both directions -->Deeper into the graph (Away from the RGGRoot) <--Back up the graph (Towards the RGGRoot)

Constructing queries Model.rgg public void findMeristems() [ l:Leaf, m:Meristem, (isSelected(l)) ::> { Shader S = RED; m.length = 0.05; m.S = S; } ] Remember: A query returns all instances of the specified pattern

Constructing queries 1. Find all Meristems above the selected leaf, including its own axillary meristem 2. Find all meristems above the selected leaf, excluding its own axillary meristem 3. Find only the axillary meristem of the next leaf 4. Find only the apical meristem

Constructing queries 1. Find all Meristems above the selected leaf, including its own axillary meristem l:Leaf )+ m:Meristem, (isSelected(l)) ::> 2. Find all meristems above the selected leaf, excluding its own axillary meristem l:Leaf (-->)+ m:Meristem, (isSelected(l)) ::>

Constructing queries 3. Find only the axillary meristem of the next leaf l:Leaf ){2} +> (>)+ m:Meristem, (isSelected(l)) ::>

Constructing queries 4. Find only the apical meristem Selected leaf is of order 0; l:Leaf )+ m:Meristem, (isSelected(l)) Selected leaf is of order 1; l:Leaf )+ m:Meristem, (isSelected(l)) l:Leaf, m:Meristem, (isSelected(l)&&l.ID==m.ID&&m.order==0)

Pipe model module internode extends Organ {... double crossArea; void PipeModel() { double NrB = count((*this Internode*)) +1; crossArea = NrB * Math.PI * InitRadius**2; radius = Math.sqrt(crossArea/Math.PI); } Make an edge pattern that finds all branches upwards in the architecture. Edge pattern Apical Meristem

Graph

Branching plant count((*this (-->)* +> (>){2} Internode*))

implementing queries in Modules.rgg Modules.rgg module Leaf extends Organ { void findMeristem [ this )+ m:Meristem ::> { Shader S = RED; m.length = 0.05; m.S = S; } ]

Aggregate methods - Object Some aggregate methods take a sequence of objects (nodes) as input and return a single object. first()the first object in the sequence last()the last object in the sequence empty()returns true if the sequence is empty selectWhere() selectWhereMin() selectWhereMax() selectRandomly()

Aggregate methods - Object selectWhere((*...*),Logical_Statement) selectWhere((*a:A*),a.rank==1) selectWhereMax ((*...*),value), selectWhereMin() selectWhereMax((*a:A*),a.rank) selectRandomly((*...*),probability) selectRandomly ((*a:A*),1) selectRandomly ((*a:A*),a.rank) selectRandomly ((*a:A, (a.order>0)*),a.rank)

implementing queries in Modules.rgg Modules.rgg Module Leaf extends Organ { void findMeristem { Meristem m = last((* this )+ M:Meristem, (M.ID==ID)*)); Shader S = RED; m.length = 0.05; m.S = S; } Note the [ bracket is now a {