NetLogo 5th IISM

Post on 12-Jan-2017

100 views 0 download

Transcript of NetLogo 5th IISM

Programming Mathematical

Models…with NetLogo

Juan Carlos García Vázquez / Fernando Sancho Caparrini

5ª Escuela Internacional de Verano de Matemáticas (5ª EIVM)5th International Summer School of Mathematics (5th ISSM)

5ª Escuela Internacional de Verano de Matemáticas / 5th International Summer School of Mathematics (5th EIVM)

What we will see today…

Modeling + Experimentation in MathematicsProblem + Tool

Complex System + Computational ModelCellular Automata + Multiagent System

(NetLogo)

On Problem Modeling

5ª Escuela Internacional de Verano de Matemáticas / 5th International Summer School of Mathematics (5th EIVM)

Discovering the World

5ª Escuela Internacional de Verano de Matemáticas / 5th International Summer School of Mathematics (5th EIVM)

Discovering the World

ScientificMethod

5ª Escuela Internacional de Verano de Matemáticas / 5th International Summer School of Mathematics (5th EIVM)

Discovering the World

ScientificMethod

• Observation• Hypotheses Formulation• Experimentation• Theses (or refutation)

5ª Escuela Internacional de Verano de Matemáticas / 5th International Summer School of Mathematics (5th EIVM)

Modeling the World

Real World

Models

5ª Escuela Internacional de Verano de Matemáticas / 5th International Summer School of Mathematics (5th EIVM)

What is a Model

A model is an abstract representation of some concrete aspects of “reality”. It consists of:• The elements that characterize the aspects of the modeled reality, and• The relations between these elements

• Mathematical Theories

• Numerical Models

• Computational Models

Mathematical Modeling

5ª Escuela Internacional de Verano de Matemáticas / 5th International Summer School of Mathematics (5th EIVM)

Modeling ProcessPhenome

non

FormalizationModel

Interpretation

Implementation

Evaluation

5ª Escuela Internacional de Verano de Matemáticas / 5th International Summer School of Mathematics (5th EIVM)

Modeling Process: NetLogoPhenome

non

FormalizationModel

Implementation

Evaluation

NetLogo

Interpretation

5ª Escuela Internacional de Verano de Matemáticas / 5th International Summer School of Mathematics (5th EIVM)

Modeling Process: NetLogoPhenome

non

FormalizationModel

Implementation

Evaluation

NetLogo

Interpretation

This is what

we do in Mathemati

cs!!!

5ª Escuela Internacional de Verano de Matemáticas / 5th International Summer School of Mathematics (5th EIVM)

Selecting a Problem…• One hard… really hard• In the limit of standard Mathematics• One we can find everywhere• Pure and Applied… at a time• Where we can make experiments and provide

hypotheses

Complex Systems

5ª Escuela Internacional de Verano de Matemáticas / 5th International Summer School of Mathematics (5th EIVM)

What is a Complex System?

Science of Complex Systems tries to describe different systems (biological, mathematical, social, physical,…) emphisizing their decomposition in simple elements and the interactions between them, and in the emergence of behaviours that are not a priori predictable by using the current tolos (mathematical, theoretical, etc.).

5ª Escuela Internacional de Verano de Matemáticas / 5th International Summer School of Mathematics (5th EIVM)

What is a Complex System?

They are everywhere…

… think and say…

5ª Escuela Internacional de Verano de Matemáticas / 5th International Summer School of Mathematics (5th EIVM)

Cellular Automata: A “Simple” Complex System

1D All the cells work on a parallel and

synchronized way

5ª Escuela Internacional de Verano de Matemáticas / 5th International Summer School of Mathematics (5th EIVM)

Cellular Automata: A “Simple” Complex System

1D All the cells work on a parallel and

synchronized way Some Questions:• Can you enumerate 1D

CA?• How many 1D CA can

you build?• Can you think in

methods to create variants of 1D CA?

5ª Escuela Internacional de Verano de Matemáticas / 5th International Summer School of Mathematics (5th EIVM)

Cellular Automata: A “Simple” Complex System

2D

All the cells work on a parallel and

synchronized way

5ª Escuela Internacional de Verano de Matemáticas / 5th International Summer School of Mathematics (5th EIVM)

Cellular Automata: A “Simple” Complex System

2DSome Questions:• Can you enumerate 2D

CA?• How many 2D CA can

you build?• Can you think in

methods to create variants of 2D CA?

NetLogo: A Modeling Tool

5ª Escuela Internacional de Verano de Matemáticas / 5th International Summer School of Mathematics (5th EIVM)

3 Types of AgentsAgent

• Artificial and autonomous Individual.• Endowed with rules governing their behavior and their ability to make decisions.• Interact between them and with the environment.

Environment

Agent

Links

Interactions

5ª Escuela Internacional de Verano de Matemáticas / 5th International Summer School of Mathematics (5th EIVM)

3 Types of Agents

Patches

Turtles

Links

Interactions

Agent

• Artificial and autonomous Individual.• Endowed with rules governing their behavior and their ability to make decisions.• Interact between them and with the environment.

5ª Escuela Internacional de Verano de Matemáticas / 5th International Summer School of Mathematics (5th EIVM)

Patches World• Rectangular 2D World tessellated by patches• Associated coordinate system• Several topologies

5ª Escuela Internacional de Verano de Matemáticas / 5th International Summer School of Mathematics (5th EIVM)

Patches World• Rectangular 2D World tessellated by patches• Associated coordinating system• Several topologies

5ª Escuela Internacional de Verano de Matemáticas / 5th International Summer School of Mathematics (5th EIVM)

Patches WorldWorld Settings View Settings

5ª Escuela Internacional de Verano de Matemáticas / 5th International Summer School of Mathematics (5th EIVM)

Patches World

Properties:• (pxcor, pycor)• pcolor• plabel, plabel-color

InspectPatch

5ª Escuela Internacional de Verano de Matemáticas / 5th International Summer School of Mathematics (5th EIVM)

Let’s Go!!

We will use patches to model a specific (and very interesting) type of 2D Cellular Automata:• The behavior of every cell depends on:• The cell is alive or not, and• How many neighbors are alive

•… and then we will play with a concrete case called Game of Life

J. Conway

5ª Escuela Internacional de Verano de Matemáticas / 5th International Summer School of Mathematics (5th EIVM)

Conways’ Game of Life

• A live cell stays alive if it has 2 or 3 live neighbors, otherwise it died

• A dead cell comes to life if it has exactly 3 live neighbors, otherwise it stays dead