Top Banner
Software Praktikum Projects Stefan Resmerita Winter semester 2013
28

Software Praktikum Projects

Oct 26, 2021

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Software Praktikum Projects

Software Praktikum Projects

Stefan Resmerita

Winter semester 2013

Page 2: Software Praktikum Projects

2 Software Praktikum - WS2013 (Stefan Resmerita)

Projects 1&2: Modeling and Simulation of Multi-Agent Systems

Page 3: Software Praktikum Projects

3 Software Praktikum - WS2013 (Stefan Resmerita)

Overview of projects 1&2

• Prerequisite: Java • Goal: simulate Multi-Agent Systems where agents

traverse a graph according to given rules and each agent is modeled as a DAG annotated with node occupation times (timed DAG)

• Projects: 1. Generate random inputs and check the output 2. Execute a given traversal algorithm by discrete-event

simulation

• Use the Ptolemy II framework http://ptolemy.eecs.berkeley.edu/ptolemyII/

Page 4: Software Praktikum Projects

4 Software Praktikum - WS2013 (Stefan Resmerita)

Software for Modeling and Simulation

• Extend software frameworks by adding new components

• Create models of systems in the extended framework

• Run simulations and obtain results

Page 5: Software Praktikum Projects

5 Software Praktikum - WS2013 (Stefan Resmerita)

Multi-Agent Systems (MAS)

• Agent: an entity (e.g., object in the OO sense) which behaves depeding on its own goals and on the behaviors and goals of the other agents – Example: an airplane

• Environment: the medium in which the agents evolve and interact – Example: the airspace and the traffic control system

• Emergent behaviors: characteristics of the entire multi-agent system resulting from the individual agent behavior – Example: airspace congestion

Page 6: Software Praktikum Projects

6 Software Praktikum - WS2013 (Stefan Resmerita)

Simulation of MAS

• The MAS challenge: determine individual agent behaviors which lead to desirable emergent behaviors

– Example: given a set of airplanes, determine the set of possible trajectories for each airplane such that collisions and traffic congestion are avoided

• Simulation is one way to address this challenge

Page 7: Software Praktikum Projects

7 Software Praktikum - WS2013 (Stefan Resmerita)

Our MAS

• Environment: a finite set of resources plus a mechanism to prioritize access to resources

• Agent: a finite set of behaviors, where a behavior represents a finite sequence of resource occupations

• An agent is represented by a set of trajectories which specify the resources and their occupation times

• Main requirement on the emergent behavior: no two agents may occupy a resource at the same time

Page 8: Software Praktikum Projects

8 Software Praktikum - WS2013 (Stefan Resmerita)

MAS Example 1

• Conflict detection

• Prioritization

• Conflict resolution

Page 9: Software Praktikum Projects

9 Software Praktikum - WS2013 (Stefan Resmerita)

MAS Example 2

Page 10: Software Praktikum Projects

10 Software Praktikum - WS2013 (Stefan Resmerita)

MAS Example 3: Airspace application

Page 11: Software Praktikum Projects

11 Software Praktikum - WS2013 (Stefan Resmerita)

MAS Example 3: Agent models

Page 12: Software Praktikum Projects

12 Software Praktikum - WS2013 (Stefan Resmerita)

Project requirements

• Random generation of agent models

• Random generation of prioritization

• Run discrete-event simulations to obtain the solution according to the formal specifications

• Check the outputs

Page 13: Software Praktikum Projects

13 Software Praktikum - WS2013 (Stefan Resmerita)

Discrete Event Simulation

Introduction

Page 14: Software Praktikum Projects

14 Software Praktikum - WS2013 (Stefan Resmerita) Slide from Lee & Seshia

Discrete Event Systems

• A dynamical system whose evolution is governed by the occurrence of events at discrete time points, at possibly irregularly-spaced intervals (Informal defn)

• Many cyber-physical systems are modeled as discrete-event systems: – Communication networks – Microprocessors – Manufacturing facilities – Communicating robots

Page 15: Software Praktikum Projects

15 Software Praktikum - WS2013 (Stefan Resmerita) Slide from Lee & Seshia

Example: Communicating Robots/Sensor Nodes

Network can fwd, corrupt, drop packets

send recv

Page 16: Software Praktikum Projects

16 Software Praktikum - WS2013 (Stefan Resmerita) Slide from Lee & Seshia

Simulating a Discrete-Event System (DES)

Discrete-Event System

Input Process

3. How to check Output?

2. How to generate random input?

i/p o/p

Environment

1. How to simulate the system on an input?

Page 17: Software Praktikum Projects

17 Software Praktikum - WS2013 (Stefan Resmerita) Slide from Lee & Seshia

Simulating the System with an Event Queue

• Simulation Timer, T = 0

• Repeat while there are events in the event queue: 1. Dequeue event at head of queue (“imminent event”)

2. Advance simulation timer to time of imminent event

3. Execute imminent event: update system state

4. Generate future events and enqueue them

. . .

Event queue

t1

e1

t2

e2

t3

e3

timestamp

event record t1 < t2 < t3 < …

Page 18: Software Praktikum Projects

18 Software Praktikum - WS2013 (Stefan Resmerita) Slide from Lee & Seshia

Example of Simulation with Event Queue

Network

1

2

3

e1 = send(1, 2, 00)

T = 0

. . .

Event queue

1.5

e1

e2 = send(3, 1, 10)

3.8

e2

Page 19: Software Praktikum Projects

19 Software Praktikum - WS2013 (Stefan Resmerita) Slide from Lee & Seshia

Example of Simulation with Event Queue

Network

1

2

3

e3 = fwd(2, 1, 00)

T = 1.5

. . .

Event queue

1.6

e3

e2 = send(3, 1, 10)

3.8

e2

Page 20: Software Praktikum Projects

20 Software Praktikum - WS2013 (Stefan Resmerita) Slide from Lee & Seshia

Example of Simulation with Event Queue

Network

1

2

3

e4 = recv(2, 1, 00)

T = 1.6

. . .

Event queue

3.8

e2

e2 = send(3, 1, 10)

4.1

e4

Page 21: Software Praktikum Projects

21 Software Praktikum - WS2013 (Stefan Resmerita) Slide from Lee & Seshia

Implementing the Event Queue

• Event with smallest time-stamp must be dequeued

• New events must be inserted into sorted order according to their timestamps

• Efficient Data Structure: Priority Queue

• Particular version: Calendar Queue

[R. Brown, Comm. of the ACM, 1988, vol. 31(10)]

Page 22: Software Praktikum Projects

22 Software Praktikum - WS2013 (Stefan Resmerita) Slide from Lee & Seshia

Simulating a Discrete-Event System (DES)

Discrete-Event System

Input Process

3. How to check Output?

2. How to generate random input?

i/p o/p

Environment

1. How to simulate the system?

Input Process

Page 23: Software Praktikum Projects

23 Software Praktikum - WS2013 (Stefan Resmerita)

Actor-Oriented Design and The Ptolemy II

framework http://ptolemy.eecs.berkeley.edu/

Page 24: Software Praktikum Projects

24 Software Praktikum - WS2013 (Stefan Resmerita)

Ptolemy II objectives

• Supports modeling, simulation and design of concurrent systems

• Promotes component-based modeling, where a component represents a domain-specific entity and it is called an actor

• Provides widely-used models of interaction between components, called models of computation

• Advocates a programming discipline called Actor-Oriented Programming

• Focuses on flexibility • Encourages experimentation with designs

Page 25: Software Praktikum Projects

25 Software Praktikum - WS2013 (Stefan Resmerita)

Actor Oriented Design

• Actors are conceptually concurrent (no predefined order of execution)

• Actors interact by sending messages through channels

• An actor implements an execution interface

• Dedicated components are responsible for data transfer between actors and for executing the actors

• Actors can be hierarchically composed

Page 26: Software Praktikum Projects

26 Software Praktikum - WS2013 (Stefan Resmerita) Slide from Lee & Seshia

AOD versus OOD (I)

class name

data

methods

call return

What flows through an object is sequential

control

Object orientation:

Actor orientation:

actor name

data (state)

ports Input data

parameters Output data

What flows through an object is streams

of data

Page 27: Software Praktikum Projects

27 Software Praktikum - WS2013 (Stefan Resmerita) Slide from Lee & Seshia

AOD versus OOD (II)

Identified limitations of object orientation: Says little or nothing about concurrency and time Concurrency typically expressed with threads, monitors, semaphores Components tend to implement low-level communication protocols

Re-use potential is disappointing

OO interface definition gives procedures

that have to be invoked in an order not

specified as part of the interface definition.

TextToSpeech

initialize(): void

notify(): void

isReady(): boolean

getSpeech(): double[]

actor-oriented interface definition says

“Give me text and I’ll give you speech”

Actor oriented Object oriented

Page 28: Software Praktikum Projects

28 Software Praktikum - WS2013 (Stefan Resmerita)

Next project steps

• Read and understand the formal MAS description (to be sent by e-mail)

• Create and run simple DE models in Ptolemy II

• Links:

– The Ptolemy II web site: http://ptolemy.eecs.berkeley.edu/ptolemyII/

– The Ptolemy II book:

http://ptolemy.org/systems