+ Simulation Design. + Types event-advance and unit-time advance. Both these designs are event-based but utilize different ways of advancing the time.

Slides:



Advertisements
Similar presentations
Heuristic Search techniques
Advertisements

+ Validation of Simulation Model. Important but neglected The question is How accurately does a simulation model (or, for that matter, any kind of model)
COP 3502: Computer Science I (Note Set #21) Page 1 © Mark Llewellyn COP 3502: Computer Science I Spring 2004 – Note Set 21 – Balancing Binary Trees School.
Chapter 4: Trees Part II - AVL Tree
Data Structures and Algorithms (60-254)
Modeling & Simulation. System Models and Simulation Framework for Modeling and Simulation The framework defines the entities and their Relationships that.
C++ Programming: Program Design Including Data Structures, Third Edition Chapter 17: Linked Lists.
C++ Programming: Program Design Including Data Structures, Fifth Edition Chapter 17: Linked Lists.
Copyright © Cengage Learning. All rights reserved. CHAPTER 11 ANALYSIS OF ALGORITHM EFFICIENCY ANALYSIS OF ALGORITHM EFFICIENCY.
CPSC 531: DES Overview1 CPSC 531:Discrete-Event Simulation Instructor: Anirban Mahanti Office: ICT Class Location:
Chapter 3: Arrays, Linked Lists, and Recursion
Lab 01 Fundamentals SE 405 Discrete Event Simulation
Cmpt-225 Simulation. Application: Simulation Simulation  A technique for modeling the behavior of both natural and human-made systems  Goal Generate.
Binary Trees Chapter 6.
1.A file is organized logically as a sequence of records. 2. These records are mapped onto disk blocks. 3. Files are provided as a basic construct in operating.
CHP - 9 File Structures. INTRODUCTION In some of the previous chapters, we have discussed representations of and operations on data structures. These.
File Organization Techniques
ICS 220 – Data Structures and Algorithms Week 7 Dr. Ken Cosh.
CHAPTER 71 TREE. Binary Tree A binary tree T is a finite set of one or more nodes such that: (a) T is empty or (b) There is a specially designated node.
Tree.
Towers of Hanoi. Introduction This problem is discussed in many maths texts, And in computer science an AI as an illustration of recursion and problem.
Chapter 6: CPU Scheduling
CHP-4 QUEUE.
TK1924 Program Design & Problem Solving Session 2011/2012 L6: Queues.
Data Structures Week 5 Further Data Structures The story so far  We understand the notion of an abstract data type.  Saw some fundamental operations.
Chapter 6 Binary Trees. 6.1 Trees, Binary Trees, and Binary Search Trees Linked lists usually are more flexible than arrays, but it is difficult to use.
CSC 211 Data Structures Lecture 13
A first look an ADTs Solving a problem involves processing data, and an important part of the solution is the careful organization of the data In order.
Symbol Tables and Search Trees CSE 2320 – Algorithms and Data Structures Vassilis Athitsos University of Texas at Arlington 1.
© 2010 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of CHAPTER 12: Multi-way Search Trees Java Software Structures: Designing.
Time Management.  Time management is concerned with OS facilities and services which measure real time, and is essential to the operation of timesharing.
Linked List. Iterators Operation to find a link, deleting, and inserting before or after a specified link, also involve searching through the list to.
NETW 707 Modeling and Simulation Amr El Mougy Maggie Mashaly.
Dynamic Array. An Array-Based Implementation - Summary Good things:  Fast, random access of elements  Very memory efficient, very little memory is required.
1 Simulation Implementation Using high-level languages.
Kovács Zita 2014/2015. II. félév DATA STRUCTURES AND ALGORITHMS 26 February 2015, Linked list.
Linked List by Chapter 5 Linked List by
UNIT 5.  The related activities of sorting, searching and merging are central to many computer applications.  Sorting and merging provide us with a.
Sorting and Searching by Dr P.Padmanabham Professor (CSE)&Director
Problem Reduction So far we have considered search strategies for OR graph. In OR graph, several arcs indicate a variety of ways in which the original.
ALGORITHMS.
© Love Ekenberg Hashing Love Ekenberg. © Love Ekenberg In General These slides provide an overview of different hashing techniques that are used to store.
1 CSCD 326 Data Structures I Hashing. 2 Hashing Background Goal: provide a constant time complexity method of searching for stored data The best traditional.
Chapter 5 Linked List by Before you learn Linked List 3 rd level of Data Structures Intermediate Level of Understanding for C++ Please.
C++ How to Program, 7/e © by Pearson Education, Inc. All Rights Reserved.
1. Searching The basic characteristics of any searching algorithm is that searching should be efficient, it should have less number of computations involved.
Advantages of simulation 1. New policies, operating procedures, information flows and son on can be explored without disrupting ongoing operation of the.
Time Management.  Time management is concerned with OS facilities and services which measure real time.  These services include:  Keeping track of.
 Simulation enables the study of complex system.  Simulation is a good approach when analytic study of a system is not possible or very complex.  Informational,
Onlinedeeneislam.blogspot.com1 Design and Analysis of Algorithms Slide # 1 Download From
Copyright © 2014 Curt Hill Algorithms From the Mathematical Perspective.
 2006 Pearson Education, Inc. All rights reserved. 1 Searching and Sorting.
MODELING AND SIMULATION CS 313 Simulation Examples 1.
Simulation Examples And General Principles Part 2
CHAPTER 51 LINKED LISTS. Introduction link list is a linear array collection of data elements called nodes, where the linear order is given by means of.
Arrays Department of Computer Science. C provides a derived data type known as ARRAYS that is used when large amounts of data has to be processed. “ an.
Given a node v of a doubly linked list, we can easily insert a new node z immediately after v. Specifically, let w the be node following v. We execute.
Data Structures and Algorithm Analysis Dr. Ken Cosh Linked Lists.
Data Structure and Algorithm: CIT231 Lecture 6: Linked Lists DeSiaMorewww.desiamore.com/ifm1.
LINKED LISTS.
© Oxford University Press All rights reserved. Data Structures Using C, 2e Reema Thareja.
Data Structures Using C, 2e
Queues.
Data Structures Interview / VIVA Questions and Answers
Introduction to Data Structure
Chapter 6: CPU Scheduling
24 Searching and Sorting.
Advanced Implementation of Tables
Queueing Theory Chapter 1
Chapter 4: Simulation Designs
Presentation transcript:

+ Simulation Design

+ Types event-advance and unit-time advance. Both these designs are event-based but utilize different ways of advancing the time The third design is activity- based.

+ Event-advance design Described in previous weeks Briefly The basic idea behind this design is that the status of the system changes each time an event occurs. During the time that elapses between two successive events, the system's status remains unchanged. it suffices to monitor the changes in the system's status. In order to implement this idea, each event is associated with a clock. The value of this clock gives the time instance in the future that this event will occur. upon completion of processing an event, say at time t1, regroups all the possible events that will occur in the future and finds the one with the smallest clock value.

+ Cont. The simulation model, therefore, moves through time by simply visiting the time instances at which events occur. In the machine interference problem, Two Type of event the event of an arrival at the repairman's queue, and the event of a departure from the repairman's queue. primary events. Quite often the occurrence of a primary event may trigger off the creation of a new event.

+ Basic Approach

+ Future event list Let us assume that a simulation model is currently at time t. The collection of all events scheduled to occur in the future, i.e., events with clock greater than t, is known as the future event list. For instance, in the case of the machine interference problem there were only two: an arrival to the repairman's queue and a service-ending (departure) event. Naturally, it is important to have an efficient algorithm for finding the next event since this operation may well account for a large percentage of the total computations involved in a simulation program

+ Propertıes of Event List

+ Sequential arrays all future event times are stored sequentially in an array. The simplest way to implement this, is to associate each event type with an integer number i. The advantage of storing an event list in a sequential array is that insertions of new events and deletions of caused events can be done very easily

+ Linked lists Node Link next data element of node each node will consist of two data elements, namely a clock CLi showing the future time of an event, and a value i indicating the type of event. The nodes are arranged in an ascending order so that CLi ≤ CLj ≤... ≤ CLn.

+ Implementation of a future event list as a linked list

+ Creating and deleting nodes the structure can contain other satellite data which may be specific to each event.

+ Deletion of a node

+ Creating linked lists, inserting and removing nodes The node can then be inserted into the list in an appropriate position such that the nodes are ordered according to a specified field.

+ Case 1 head is NULL

+ Case 2: head->clock > newNodePtr- >clock

+ Case 3: Insertion between head and last node of the list

+ Removing a node from the linked list The linked list is always maintained in an ascending order of the clock value. Therefore, the next event to occur is the first node of the linked list.

+ Time complexity of linked lists Insert / Remove In order to insert a node in the linked list we have to traverse the linked list and compare each node until we find the correct insertion position The maximum number of nodes compared in the worst case will be the total number of nodes in the list. Thus the complexity of the insert operation is linear on n. Searching a linked list might be time consuming if n is very large. In this case, one can employ better searching procedures. For example, a simple solution is to maintain a pointer B to a node which is in the middle of the linked list.

+ Doubly linked lists

+ Unit-time advance design the master clock can be advanced in fixed increments of time, each increment being equal to one unit of time. Each time the master clock is advanced by a unit time, all future event clocks are compared with the current value of the master clock. If no clock is equal to the current value of the master clock, then no event has occurred and no action has to take place. In either case, the master clock is again increased by unit time and the cycle is repeated. This mode of advancing the simulation through time

+

+ Alternative Future Clock future event clock is a variable which, as in the case of the vent-advance design, contains a future time with respect to the origin Alternatively, a future clock can simply reflect the duration of a particular activity. Each time the master clock is advanced by a unit of time, the value of each future clock is decreased by a unit time. If any of these clocks becomes equal to zero, then the associated event has occurred and appropriate action has to take place.

+

+ Selecting a unit time The unit time is readily obtained in the case where all future event clocks are represented by integer variables For, each event clock is simply a multiple of the unit time. frequently future event clocks are represented by real variables.

+ Complications This introduces inaccuracies when estimating time parameters related to the occurrence of events. Another complication that might arise is due to the possibility of having multiple events occurring during the same unit of time. In general, a unit time should be small enough so that at most one event occurs during the period of a unit of time However, if it is too small, the simulation program will spend most of its time in non-productive mode, i.e. advancing the master clock and checking whether an event has occurred or not. simple heuristic rule such as setting the unit time equal to one-half of the smallest variate generated.

+ Cont. For instance, one can start with a small unit time. Then, it can be slightly increased. If it is found to have no effect on the computed results, then it can be further increased, and so on.

+ Implementation The main operation related to the processing of the future event list is to compare all the future event clocks against the master clock each time the master clock is increased by a unit time. An implementation using a sequential.

+ Event-advance vs. unit-time advance where there are many events which occur at times close to each other The best case, in fact, would occur when the events are about a unit time from each other. The worst case for the unit-time advance method is when there are few events and they are far apart from each other. ??

+ Activity-based simulation design he system modelled is viewed as a collection of activities or processes. a single server queueing system can be seen as a collection of the following activities: a) inter arriving, b) being served, and c) waiting for service In an activity based design, one mainly concentrates on the set of conditions that determine when activities start or stop. This design is useful when simulating systems with complex interactive processing patterns, sometimes referred to as machine-oriented models.

+ Example Single server Queue in the simulation model of the single server queue, an arrival or a departure will change the status of the system STi the service Wti the waiting time of arrival ATi+1 be the interarrival time between the ith and (i+1)st arrival assume that the ith arrival occurs at time ai, starts its service at time si and ends its service at time si + STi,

+ Cont. assume that we know the waiting time WTi and the service time STi of the ith customer Let ATi+1 be the inter-arrival time of the (i+1)st custom The (i+1)st arrival occurs during the time that the ith arrival is waiting. The (i+1)st arrival occurs when the ith arrival is in service The (i+1)st arrival occurs after the ith arrival has departed from the queue For each of these three cases, the waiting time WTi+1 of the (i+1)st customer can be easily determined as follows: TW i is the total waiting time in the system of customer i.

+ Having calculated WTi+1, we generate a service time STi+1 for the (i+1)st arrival, and an inter-arrival time ATi+2 for the (i+2)nd arrival. The waiting time of the (i+2)nd arival can be obtained using the above expressions.

+

+ Examples ?? An inventory system A round-robin queue