Daniel Strebel Eduardo Hernández Marquina Advanced Functional Programming.

Slides:



Advertisements
Similar presentations
Implementation and Verification of a Cache Coherence protocol using Spin Steven Farago.
Advertisements

1 Concurrency Control III Dead Lock Time Stamp Ordering Validation Scheme.
Sharks and Fishes – The problem
Vered Gafni – Formal Development of Real Time Systems 1 Statecharts Semantics.
Concurrency Control II
BASIC BUILDING BLOCKS -Harit Desai. Byzantine Generals Problem If a computer fails, –it behaves in a well defined manner A component always shows a zero.
Token-Dased DMX Algorithms n LeLann’s token ring n Suzuki-Kasami’s broadcast n Raymond’s tree.
Chapter 6: Process Synchronization
Parallel and Distributed Simulation Lookahead Deadlock Detection & Recovery.
Lookahead. Outline Null message algorithm: The Time Creep Problem Lookahead –What is it and why is it important? –Writing simulations to maximize lookahead.
What’s a food chain? Predators and prey Food Chains.
Deadlocks in Distributed Systems Ryan Clemens, Thomas Levy, Daniel Salloum, Tagore Kolluru, Mike DeMauro.
Interactions Among Organisms Is mainly about competition and survive to adapt to their habitat. By D.J –Kenna – Kelsea.
Suharsh Sivakumar December 11,  A grid of cells where all the cells are governed by a common set of rules based on the number of adjacent neighbors.
Game of Life Courtesy: Dr. David Walker, Cardiff University.
1 Friday, June 16, 2006 "In order to maintain secrecy, this posting will self-destruct in five seconds. Memorize it, then eat your computer." - Anonymous.
Introduction to Lock-free Data-structures and algorithms Micah J Best May 14/09.
NEW TIES WP2 Agent and learning mechanisms. Decision making and learning Agents have a controller (decision tree, DQT)  Input: situation (as perceived.
Brooke Ard 5 th Grade Math/Science Griggs Road Elementary.
The Food Chain.
Cellular Automata and Game Design By Pete Strader.
Variations of Conway’s Game of Life Eswar Kondapavuluri.
The Hot Desert Ecosystem
Every living thing needs energy in order to survive. Every time animals do something (run, jump, move) they use energy to do so. Plants don’t move, so.
Apache JMeter By Mohamed Talaat
1 Thread Synchronization: Too Much Milk. 2 Implementing Critical Sections in Software Hard The following example will demonstrate the difficulty of providing.
Object Oriented Analysis & Design SDL Threads. Contents 2  Processes  Thread Concepts  Creating threads  Critical sections  Synchronizing threads.
WP3 EDG WP3 Meeting 14/01/04 – 16/01/04 Schema Replication.
OpenMP OpenMP A.Klypin Shared memory and OpenMP Simple Example Threads Dependencies Directives Handling Common blocks Synchronization Improving load balance.
Ecosystem A place with living and nonliving things.
Problem Solving with Data Structures using Java: A Multimedia Approach Chapter 14: Using an Existing Simulation Package.
Food Chains and Ecosystems
Today we are going to learn about: Food Chains KEY WORDS food chain consumer producer predator prey.
The Organization of Living Things
November 15, 2007 A Java Implementation of a Lock- Free Concurrent Priority Queue Bart Verzijlenberg.
The Game of Life A simulation of "life". From simple rules, complex behavior arises Rules –A cell that is alive and has fewer than two live neighbors dies.
TRANSACTION MANAGEMENT R.SARAVANAKUAMR. S.NAVEEN..
Modeling Complex Dynamic Systems with StarLogo in the Supercomputing Challenge
Unit B: Chapter 2 Vocabulary Living Things Depend on One Another.
S7L4a Demonstrate in a food web that matter is transferred from one organism to another and can recycle between organisms and their environments. Food.
Design Issues. How to parallelize  Task decomposition  Data decomposition  Dataflow decomposition Jaruloj Chongstitvatana 2 Parallel Programming: Parallelization.
Design of Bio-Medical Virtual Instrumentation Tutorial 2.
Games Development 2 Overview & Entity IDs and Communication CO3301 Week 1.
(1) A beginners guide to testing Philip Johnson Collaborative Software Development Laboratory Information and Computer Sciences University of Hawaii Honolulu.
Agenda OS v1.1 update - New feature in DE to support static fields (Fancy controls) Advance Query new feature demo - Support for.
Every living thing needs energy in order to live. Every time animals do something (run, jump, move) they use energy to do so.
Multithreading Chapter Introduction Consider ability of human body to ___________ –Breathing, heartbeat, chew gum, walk … In many situations we.
28 minutes before 6 players setup Basic move Each player gets per turn: 1.Max 3 people per move 2.Max 3 zombies per move.
Hwajung Lee. Well, you need to capture the notions of atomicity, non-determinism, fairness etc. These concepts are not built into languages like JAVA,
Hwajung Lee. Why do we need these? Don’t we already know a lot about programming? Well, you need to capture the notions of atomicity, non-determinism,
Animals that eat BOTH animals and plants are called omnivores.
November 27, 2007 Verification of a Concurrent Priority Queue Bart Verzijlenberg.
THIS IS With Host... Your Vocab. IVocab. IIFinish the Chain Consumer, Producer, Decomposer?? Misc. Column F Australian Animals.
Food Web & Food Chains Quiz 1. an animal that eats only other animals A. consumer B. herbivore C. carnivore D. omnivore.
The Needs of Multicellular Organisms By Alex H., Noah Allen, Marcus “Special T” Tillman and Jeremy S.
LO: To be able to describe what a food chain is and give examples Success Criteria I can identify what animals eat I can identify what might eat a particular.
 A food chain is a list of animals that eat each other.  At the top of the food chain are the largest carnivores, such as lions and tigers. They only.
Process Scheduling. Scheduling Strategies Scheduling strategies can broadly fall into two categories  Co-operative scheduling is where the currently.
WEEBLY 101 MAKING AN AWESOME WEBPAGE. WEEBLY 101 PLANNING A WEB PAGE WHAT WOULD YOU LIKE YOUR PAGE TO LOOK LIKE? EXAMPLES:
Food Chain.
Chapter 5: Process Synchronization – Part 3
Multithreading Chapter 23.
Module 7a: Classic Synchronization
Single Value Processing Multi-Threaded Process
Game of Life Presentation Byung-guk Kim
Food chains begin with plant-life, and end with animal-life.
EET 2259 Unit 7 Case Structures; Sequence Structures
Atlantis Game.
Synchronization and liveness
Presentation transcript:

Daniel Strebel Eduardo Hernández Marquina Advanced Functional Programming

1.- The Problem 2.- Design 3.- Demo 4.- Limitations 5.- Algorithms 6.- Why we produces correct results 7.- Difficult cases Agenda

The board: A grid where the different elements are going to interact. The Problem

Elements »Fences: Static elements »Grass: Procreate The Problem Cont.

Elements Cont: Abilities: - Move - Eat - Procreate The Problem Cont.

Design

Design cont. Fox_1Rabbit_1Grass_1Rabbit_2 {4,3}, rabbit_1 {3,6}, fox_2 {1,4}, grass_2 {4,8}, grass_3 {7,3}, grass_1 {5,8}, rabbit_2 {8,5}, fox_1 Todo Position-PID

Design cont. Initialization Todo > 0 Build new Todo Wait for Message NOYES

Design cont. time {start} {move, 3,2 } {ok} {req_neighbors} {neighbors, [{5,4, fox},.]}

Design cont. time {start} {move, 3,2 } {conflict, [{5,4, fox},.]} {req_neighbors} {neighbors, [{5,4, fox},.]} {eat, 4,4} Request not valid! {ok}

Demo

Missing AI - Now action choices are random. How to add simple AI? - Need to know the positions around. - Develop action priorities. 1.- Stay alive: scape from predators or eat. 2.- To find food: move away from borders. Limitations

Algorithms Atoms for element types Code sharing between animals Used libraries

Algorithms cont animal_loop(Position, States, Default_States, Types) -> receive {die, _} -> urks; {start, Gameboard_PID} -> Gameboard_PID ! {request_neighbors, Position, self()}, receive {die, _} -> urks; {neighbors, Neighbor_List} -> decide_animal(Neighbor_List, Gameboard_PID, Position, States, Default_States, Types) end end. {Eat_timer, Procreation_timer, Starvation_timer, Move_timer} {Own_Type, Prey_Type}

Algorithms cont decide_animal(Neighbor_List, Gameboard_PID, Position, States, Default_States, Types) -> {Own_Type, Prey_Type} = Types, {Eat_timer, Procreation_timer, Starvation_timer, Move_timer} = States, Prey_Cells = [{X_cell, Y_cell} || {_, Type, X_cell, Y_cell}<-Neighbor_List, Type==Prey_Type], Free_Cells = [{X_cell, Y_cell} || {_, Type, X_cell, Y_cell}<-Neighbor_List, Type==none], case {Free_Cells, Prey_Cells, Move_timer, Eat_timer, Procreation_timer} of {_, [_|_], _, 0, 0} -> % eat timer and procreation timer are zero and there is at least one neighboring prey cell [...] {[_|_], _, 0, _, _} -> % move timer is zero and there is at least one neighboring empty cell [...] {_, _, _, _, _} -> % no possible actions [...] end.

Why this produces correct results Gameboard in charge -> consistent Elements can always select a possible actions -> no dead locks, single turns will terminate Order of execution is not guaranteed -> Non-deterministic behaviour

Difficult cases Find all possible cases of inconsistency What should be done in conflict situations? Why the heck is there a dead lock???

??!! *?#~!