Autumn School Dynamic MSM16-18 November 2015 | L-Esch-sur-Alzette Slide 1 Playing with Objects.

Slides:



Advertisements
Similar presentations
Chapter 6: Entity-Relationship Model (part I)
Advertisements

MWD1001 Website Production Using JavaScript with Forms.
Fields, Constructors, Methods
1 l Inheritance Basics l Programming with Inheritance l Dynamic Binding and Polymorphism Inheritance.
Chapter 51 Scripting With JSP Elements JavaServer Pages By Xue Bai.
CS 211 Inheritance AAA.
Rossella Lau Lecture 8, DCO10105, Semester B, DCO10105 Object-Oriented Programming and Design  Lecture 8: Polymorphism & C++ pointer  Inheritance.
Life course and cohort measures Hist Cross-sectional data “Snapshot” of a population at a particular moment Examples: Census; Tax list Limitation:
Event Processing Course Event processing networks (relates to chapter 6)
DAT602 Database Application Development Lecture 15 Java Server Pages Part 1.
Measuring Development
Exploring Office Grauer and Barber 1 Information From the Database: Reports and Queries(Wk4)
The Relational Model These slides are based on the slides of your text book.
REFACTORING Lecture 4. Definition Refactoring is a process of changing the internal structure of the program, not affecting its external behavior and.
“is a”  Define a new class DerivedClass which extends BaseClass class BaseClass { // class contents } class DerivedClass : BaseClass { // class.
Talk Presenter, NYHQ HIV/AIDS Unit9-Sep-15 Orphans in Namibia Urgent Action for Children on the Brink.
Programming with Microsoft Visual Basic 2012 Chapter 13: Working with Access Databases and LINQ.
Reusable Code For Your Appx Processes Presented By: Gary Rogers.
LIAM 2: A NEW OPEN SOURCE DEVELOPMENT TOOL FOR DISCRETE-TIME DYNAMIC MICROSIMULATION MODELS GIJS DEKKERS (FEDERAL PLANNING BUREAU, Brussels, CESO, K.U.LEUVEN.
® IBM Software Group © 2009 IBM Corporation Rational Publishing Engine RQM Multi Level Report Tutorial David Rennie, IBM Rational Services A/NZ
Statistics: Unlocking the Power of Data Lock 5 Synthesis STAT 250 Dr. Kari Lock Morgan SECTIONS 4.4, 4.5 Connecting bootstrapping and randomization (4.4)
Lesson 1: Introduction to ABAP OBJECTS Todd A. Boyle, Ph.D. St. Francis Xavier University.
LIAM 2: A NEW OPEN SOURCE DEVELOPMENT TOOL FOR THE DEVELOPMENT OF DISCRETE-TIME DYNAMIC MICROSIMULATION MODELS PHILIPPE LIÉGEOIS (CEPS/INSTEAD, Luxembourg.
CPSC1301 Computer Science 1 Chapter 11 Creating Classes part 1.
CS 4240: More Design Patterns Readings: Chap. 9. Let’s Recap Some Ideas and Strategies We’ll assume some design-planning is useful up-front Design with.
CreatingClasses-part11 Creating Classes part 1 Barb Ericson Georgia Institute of Technology Dec 2009.
Chapter 2 Adapted from Silberschatz, et al. CHECK SLIDE 16.
The Human Population Studying Human Population Chapter Nine Section One.
Georgia Institute of Technology Creating Classes part 1 Barb Ericson Georgia Institute of Technology Oct 2005.
From the initial (HINARI) PubMed page, we will run the HIV and pregnancy search and then apply various Filters. Note the to Advanced search and Help options.
Data Structures Week 8 Further Data Structures The story so far  Saw some fundamental operations as well as advanced operations on arrays, stacks, and.
Presented by : Sébastien Lauzon (Finance Canada).
5 BASIC CONCEPTS OF ANY PROGRAMMING LANGUAGE Let’s get started …
Grouper Training End Users Admin UI – Part 4 Shilen Patel Duke University This work licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported.
Exploring Office Grauer and Barber 1 Committed to Shaping the Next Generation of IT Experts. Chapter 3 - Information From the Database: Reports.
1 Chapter 17 Object-Oriented Data Structures. 2 Objectives F To describe what a data structure is (§17.1). F To explain the limitations of arrays (§17.1).
1 Advanced Reports Dr. Peter Wayne. 2 Here is the set we will use for the report.
CSC1401 Classes - 1. Learning Goals Computing concepts Identifying objects and classes Declaring a class Declaring fields Default field values.
XML – Part III. The Element … This type of element either has the element content or the mixed content (child element and data) The attributes of the.
C++ Programming Basic Learning Prepared By The Smartpath Information systems
C++ Inheritance Data Structures & OO Development I 1 Computer Science Dept Va Tech June 2007 © McQuain Generalization versus Abstraction Abstraction:simplify.
Application development with Java Lecture 21. Inheritance Subclasses Overriding Object class.
Autumn School Dynamic MSM16-18 November 2015 | L-Esch-sur-Alzette Slide 1 Note Combining LIAM2 and EUROMOD: a (useful?) possibility.
Autumn School Dynamic MSM16-18 November 2015 | L-Esch-sur-Alzette Slide 1 Aggregates, output and other basic tools.
Autumn School Dynamic MSM16-18 November 2015 | L-Esch-sur-Alzette Slide 1 7. Stochastic concepts in LIAM2.
The Prototype Pattern (Creational) ©SoftMoore ConsultingSlide 1.
American Citizen By: Nguyen Vo.  Content Area: Social Studies  Grade Level: 2 nd  Summary: The purpose of this instructional PowerPoint is teach student.
Autumn School Dynamic MSM16-18 November 2015 | L-Esch-sur-Alzette Slide 1 4. Basic concepts, a rudimentary model, and input data (demo01.yml)
1 C# - Inheritance and Polymorphism. 2 1.Inheritance 2.Implementing Inheritance in C# 3.Constructor calls in Inheritance 4.Protected Access Modifier 5.The.
SHARELIFE Meeting Vienna – November, 5-6 The Italian experience in SHARE data cleaning Paccagnella Omar Omar Paccagnella SHARELIFE meeting November 6,
CS241 Systems Programming Discussion Section Week 2 Original slides by: Stephen Kloder.
Autumn School Dynamic MSM16-18 November 2015 | L-Esch-sur-Alzette Slide 1 Advanced topics.
COP INTERMEDIATE JAVA Inheritance, Polymorphism, Interfaces.
CS241 Systems Programming Discussion Section Week 2 Original slides by: Stephen Kloder.
0 Copyright 2012 FUJITSU Interstage BOP SQL Query Tutorial Todd Palmer October 2012.
B Tree Insertion (ID)‏ Suppose we want to insert 60 into this order 3 B-Tree Starting at the root: 10 < 60 < 88, so we look to the middle child. Since.
Variables and Inheritance Part 1 Alice. Review: Properties A class defines properties for its own kind of object. When an object is created (instantiated),
Georgia Institute of Technology More on Creating Classes Barb Ericson Georgia Institute of Technology June 2006.
about me – Austin Senseman, CFA 5 years in Financial Services, Managed analytics for sales, marketing, risk, finance, &
Family and household structure Part 2
Object-Orientated Analysis, Design and Programming
7. Inheritance and Polymorphism
Appendix D: Network Model
Chapter 17 Object-Oriented Data Structures
Inheritance Virtual Functions, Dynamic Binding, and Polymorphism
Post WG LC NMDA datastore architecture draft
Collections Framework
Java Programming Language
Preference Activity class
13/05/2013 Gijs Dekkers Gaëtan de Menten Raphaël Desmet
Presentation transcript:

Autumn School Dynamic MSM16-18 November 2015 | L-Esch-sur-Alzette Slide 1 Playing with Objects

Autumn School Dynamic MSM16-18 November 2015 | L-Esch-sur-Alzette Slide 2 Topics 1.Lifecycle functions new() remove() Exercises (demo04.yml) 2.Linking objects many2one one2many links: Getting information through links Exercises (demo05.yml)

Autumn School Dynamic MSM16-18 November 2015 | L-Esch-sur-Alzette Slide 3 Creating and Removing Objects

Autumn School Dynamic MSM16-18 November 2015 | L-Esch-sur-Alzette Slide 4  New persons (instances of entities) can be added to the simulated population through birth, cloning, immigration => let’s concentrate first on births  Example (demo04+), while considering an « adult » (a possible « mother ») : new('person', filter=to_give_birth, age = 0, agegroup = 0, mother_id = id, gender = child_gender)  A new object of the type person is created if the filter condition is True  The Function “new” returns an identifier for this new object (its “id” value)  Fields are either specified or will receive “missing” value (e.g. “-1” if an integer)  Of course, to_give_birth and child_gender must be given values ex ante invoking “new” and creating the object  The right part of expressions are referring to the object which is presently considered (the “mother” in our case) => “ id ” is mother’s id Creating a new person (giving birth)

Autumn School Dynamic MSM16-18 November 2015 | L-Esch-sur-Alzette Slide 5  Cloning an instance of entity (e.g. a person) is duplicating an existing object  Cloning can e.g. be used when implementing immigration (coming back to that later)  The syntax in LIAM2 is similar as for the the NEW () function clone( filter=to_be_replicated, nationality = False)  A new object of the same type as original is created if the filter condition is True  The Function “ CLONE () ” returns an identifier for this new object (its “ id ” value)  The value of Fields in the new object are either specified (e.g; in this case, False = “Foreigner” / “not Luxembourgish”) or will be inherited from original (“parental”) values (contrarily to NEW which initializes by default with “ MISSINGS ”) Creating a new person (cloning)

Autumn School Dynamic MSM16-18 November 2015 | L-Esch-sur-Alzette Slide 6  The counterpart of births is death event  If a person dies, it can be removed from the dataset  Example (demo04) : remove(dead) Of course, the field “dead” must be initialized first dead: if(ISMALE, age >= 90, age >= 95)  « new » and « remove » are called lifecycle functions Getting rid of an Object

Autumn School Dynamic MSM16-18 November 2015 | L-Esch-sur-Alzette Slide 7 Linking Objects

Autumn School Dynamic MSM16-18 November 2015 | L-Esch-sur-Alzette Slide 8  Objects are easily linked in LIAM2, and information can be derived in an efficient way through links  2 types of Links : « many2one » …  Child => Mother  Wife => Husband  Person => Household  … and « one2many »  Mother => Children  Household => Members  We can link objects of the same entity / from different entities Linking Objects in LIAM2

Autumn School Dynamic MSM16-18 November 2015 | L-Esch-sur-Alzette Slide 9  Within the entity which is the SOURCE of link, add a “ links: ” section (cf. “ fields: ” section)  Example (Household => Members) entities: household: links: persons: {type: one2many, target: person, field: hh_id}  A link gets a name and a type, specifies the TARGET entity and the field which will make the link operational (which is in the present example a person’s field)  In this example, several persons can be linked to the same household  Other example (Child => Mother), to be declared in entity « person » mother: {type: many2one, target: person, field: mother_id} Specifying the links in LIAM2

Autumn School Dynamic MSM16-18 November 2015 | L-Esch-sur-Alzette Slide 10  « many2one » links  Most simple syntax :.  Example (mother’s age) : mother.age (Question : what about mother.mother.age ?)  Advanced syntax :.get( ) Example (income tax of the mother): mother.get(income * tax_percent) Getting information through links (1)

Autumn School Dynamic MSM16-18 November 2015 | L-Esch-sur-Alzette Slide 11  « one2many » links  We need to use aggregate functions :. ( )  Example (assuming « persons » is a link from a household to its members) persons.avg(age)  Available functions : count([filter]) sum(expr[, filter]) min, max(expr[, filter]) avg(expr[, filter]) Getting information through links (2)

Autumn School Dynamic MSM16-18 November 2015 | L-Esch-sur-Alzette Slide 12  To change object links, update the underlying field  Example (remove the link to a dead person) - mother_id: if(mother.dead, -1, mother_id)  Example (move young adults to another household) - new_hh_id: … - hh_id: if(age >= 24 and not alone, new_hh_id, hh_id) Modifying links

Autumn School Dynamic MSM16-18 November 2015 | L-Esch-sur-Alzette Slide 13 Exercises (demo04.yml)

Autumn School Dynamic MSM16-18 November 2015 | L-Esch-sur-Alzette Slide Open demo04.yml in the editor 2. Go through contents : general structure, entities, processes (list & contents) 3. How many newly born persons in 2016 ? 4. Is this about 6% of the “target” population ?  ISFEMALE and (age >= 15) and (age <= 50) 5. How many dying persons in 2017 ? 6. Simulate over 10 years. What are the changed in "agegroup" thorugh time ? 7. Try modelling twins  Since we have no stochastic functions yet, lets just say all women who give birth at 35 have twins Exercises – About new objects

Autumn School Dynamic MSM16-18 November 2015 | L-Esch-sur-Alzette Slide 15 Exercises (demo05.yml)

Autumn School Dynamic MSM16-18 November 2015 | L-Esch-sur-Alzette Slide Open demo05.yml in the editor 2. Go through contents : general structure, entities, processes (list & contents) 3. Concentrate on year 2016  What are contents of CSV outputs for households in 2016 ?  How many persons with a mother (resp. a grand-mother) among the first 10 individuals ?  For the same group, what do you expect if comparing hh_id with household.id ? Check  Among persons with id between 90 and 99, how many persons in their respective households ? Check, for hh_id = 2010 And how many adults ( age >= 18 ) ?  How could I get the average age of persons living alone ? Exercises – Linking Objects