lecture 1 - random number generation

Upload: fterasawmy

Post on 04-Jun-2018

224 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/13/2019 Lecture 1 - random number generation

    1/40

    bengu, c1/ 1

    What is simulation?

    Chapter 1?

    Pr

    Prof. Bengu

  • 8/13/2019 Lecture 1 - random number generation

    2/40

    bengu, c1/Simulation with Arena

    Fundamental Simulation Concepts Bengu, C1/2

    Simulation Is ...

    u Very broad term, set of problems/approaches

    u Generally, imitation of a system via computer

    u Involves a model validity?

    u Dont even aspire to analytic solution

    Y Don t get exact results (bad)

    Y Allows for complex, realistic models (good)

    Y Approximate answer to exact problem is betterthan exact answer to approximate problem

    u Consistently ranked as most useful, powerful

    of mathematical-modeling approache

  • 8/13/2019 Lecture 1 - random number generation

    3/40

    bengu, c1/Simulation with Arena

    Fundamental Simulation Concepts Bengu, C1/3

    Discrete-Event SystemSIMULATION

    4 Most Widely used IE tool (OR)

    Helps:

    4 to evaluate performanceof asystembefore actuallyimplementing it.

    4 to comparevarious operationalalternativeswithoutdisturbing the system.

  • 8/13/2019 Lecture 1 - random number generation

    4/40

    bengu, c1/Simulation with Arena

    Fundamental Simulation Concepts Bengu, C1/4

    Who Uses it?

    Although manufacturers have traditionally used

    simulation technology, many other industries

    have discovered the benefits of modeling a

    process and seeing potential results beforeinvesting precious resources such as

    time and money.

    In fact, simulation software and consultingservices have been used by industries such as:

  • 8/13/2019 Lecture 1 - random number generation

    5/40

    bengu, c1/Simulation with Arena

    Fundamental Simulation Concepts Bengu, C1/5

    Some Application Areas

    u Manufacturing scheduling, inventory

    u Staffing personal-service operationsBanks, fast food, theme parks, Post Office, ...

    u Distribution and logistics

    u Health care emergency, operating rooms

    u Computer systems

    u Telecommunications

    u Military

    u Public policy4 Emergency planning

    4 Courts, prisons, probation/ parole

  • 8/13/2019 Lecture 1 - random number generation

    6/40

    bengu, c1/Simulation with Arena

    Fundamental Simulation Concepts Bengu, C1/6

    Who Uses it?

    vHealth care vPublishing

    vCommunications vWaste management

    vFast food vRailroads

    vAerospace vGovernments

    vTextiles vConsumer goods

    vElectronics vPackage delivery

  • 8/13/2019 Lecture 1 - random number generation

    7/40

    b e n g u , c 1 / S i m u l a t i on w i t h A r e n a

    F u n d a m e n t a l S i m u l a t i o n C o n c e p t s B e n g u , C 1 / 7

    Systems

    uPhysical facility/ process, actual or planned

    uStudy its performance

    YMeasure

    Y ImproveY Design (if it doesn t exist)

    YMaybe control in real time

    uSometimes possible to play with the system

    uBut sometimes impossible to do soY Doesn t exist

    Y Disruptive, expensive

  • 8/13/2019 Lecture 1 - random number generation

    8/40

    b e n g u , c 1 / S i m u l a t i on w i t h A r e n a

    F u n d a m e n t a l S i m u l a t i o n C o n c e p t s B e n g u , C 1 / 8

    A group of objects joined in some regular interaction

    toward the accomplishment of some purpose.

    i.e., Production systems: machines & workers

    producing a vehicle.

    SYSTEMObjects

    Objects

    SYSTEM

    ENVIRONMENT

    Boundaries: Market Size

    Activity : ProductionAttr ibutes : Sport -Red

    Production Time

    S Y S T E M

  • 8/13/2019 Lecture 1 - random number generation

    9/40

    b e n g u , c 1 / S i m u l a t i on w i t h A r e n a

    F u n d a m e n t a l S i m u l a t i o n C o n c e p t s B e n g u , C 1 / 9

    System State: Collection of variables describing the system

    i.e., # of cars produced,Avg. # of cars in the system at any point in time (queue+service)

    Avg. Production Time

    12

    Objects

    0

    1

    2

    3

    Number of Cars Produced

    DepartureEvent

    SYSTEM STATE

    Arrival Event

  • 8/13/2019 Lecture 1 - random number generation

    10/40

    bengu, c1/Simulation with Arena

    Fundamental Simulation Concepts Bengu, C1/10

    Numerical Calculations in Computer Simulation

    SimulationTime

    EntityArrivalTime

    DepatureTime

    Time InSystem

    InterDepartureTime

    0.0 1 0 1 1-

    1.0 2 1 3 2 2

    2.0..

    3..

    2..

    5..

    3..

    2

    Total 6 4

    Avg 2 4/2=2

  • 8/13/2019 Lecture 1 - random number generation

    11/40

    bengu, c1/Simulation with Arena

    Fundamental Simulation Concepts Bengu, C1/11

    Numerical Calculations of Computer Simulation TIME

    SimulationTime

    EntityArrivalNumberof EntitiesEnteredNE+1

    DepartureNumberof EntitiesDepartedNE-1

    TimeInSystem

    0.0 1 0 1 11.0 2 1 3 2

    2.0. 3. 2. 5. 3

    Total 6 4

    Avg 2 4/3=1.3

  • 8/13/2019 Lecture 1 - random number generation

    12/40

    bengu, c1/Simulation with Arena

    Fundamental Simulation Concepts Bengu, C1/12

    Avg. Number of Entities in the System

    at any Given MomentNumber of

    Entities

    Simulation

    TimeNE=NE+1 NE=NE-1

    Avg. Number Area Under NE Curve

    of Entities = Simulation Time

    #/time # * time/ time

  • 8/13/2019 Lecture 1 - random number generation

    13/40

    bengu, c1/Simulation with Arena

    Fundamental Simulation Concepts Bengu, C1/13

    Models

    uAbstraction/ simplification of the system usedas a proxy for the system itself

    uCan try wide-ranging ideas in the model

    Y Make your mistakes on the computer where they don t count, ratherfor real where they docount

    u Issue ofmodel validit y

    uTwo types of models

    YPhysical(iconic)

    YLogical/ Mathematical-- quantitative and logical assumptions,approximations

  • 8/13/2019 Lecture 1 - random number generation

    14/40

    bengu, c1/Simulation with Arena

    Fundamental Simulation Concepts Bengu, C1/14

    What Do You Do with a Logical Model?

    u If model is simple enough, use traditionalmathematics (queueing theory, differential equations,linear programming) to get answers

    Y Nice in the sense that you get exact answers to the model

    Y But might involve many simplifying assumptions to make the model

    analytically tractable -- validity??

    uMany complex systemsrequire complex models forvalidity simulation needed

  • 8/13/2019 Lecture 1 - random number generation

    15/40

    bengu, c1/Simulation with Arena

    Fundamental Simulation Concepts Bengu, C1/15

    Computer Simulation

    uMethod for studying a wide variety of models ofreal-world systems

    Y Use numerical evaluation on computer

    Y Use software to imitate the system s operations and characteristics,

    often over time

    u In practice, is the process of designing andcreating computerized model of system anddoing numerical computer-based experiments

    uReal power application to complex systemsuSimulation can tolerate complex models

  • 8/13/2019 Lecture 1 - random number generation

    16/40

    bengu, c1/Simulation with Arena

    Fundamental Simulation Concepts Bengu, C1/16

    Simulation Software

    k Simulation can be defined as:

    Creating a computer model of a real or proposed system andconducting experiments on the model

    to describe observed behavior and/or predict future behaviorbefore investing any time or money.

    k Why Simulation?Because experimenting on a real system could be costly/ impractical,Simulation has become an extremely important toolfor designing and analyzing complex systems;it is a cost-effective way of pre-testing proposed systems,

    plans, or policies before incurring the expense of prototypes,field tests, or actual implementations.In fact, many managers have come to view simulation as aninexpensive insurancepolicy.

  • 8/13/2019 Lecture 1 - random number generation

    17/40

    bengu, c1/Simulation with Arena

    Fundamental Simulation Concepts Bengu, C1/17

    SIMULATION MODELING

    ADVANTAGES:

    Evaluates performance of a hypothesized system in a

    compressed time due to the power of computers.

    4 Easy to use (software+ hardware are getting better)

    Pitfalls:4 Easily misused: Proper Data Analysis, Validation

    Techniques, Design of Experiments are required.

    Output

    DATA

    and Analysis

    SimulationNumberCrunching

    Input

    DATA

    and Rules

  • 8/13/2019 Lecture 1 - random number generation

    18/40

    bengu, c1/Simulation with Arena

    Fundamental Simulation Concepts Bengu, C1/18

    Prerequisites

    4Elementary Statistics and Probability: Mean, Variance,

    Confidence Interval, Hypothesis Testing, Design of

    Experiments

    SIMULATION MODELING

    OutputDATA

    Simulation

    NumberCrunching

    InputDATA

    REAL

    SYSTEM

    SIMULATED

    SYSTEM

    Valid

    ?

  • 8/13/2019 Lecture 1 - random number generation

    19/40

    bengu, c1/Simulation with Arena

    Fundamental Simulation Concepts Bengu, C1/19

    REQUIREMENTS

    Presentations(Projects):4Learning by Examples (ARENA, Power Point Slides)

    Alternatives (C++, Java, Web pages)

    4Literature Search

    Content:4Concept of System, Simulation Model,

    Simulation Experiment Results

    4 Modeling Techniques: Event vs Process based

    4 Examples:Queueing Models, Inventory SystemsC++, Java Programming

  • 8/13/2019 Lecture 1 - random number generation

    20/40

    bengu, c1/Simulation with Arena

    Fundamental Simulation Concepts Bengu, C1/20

    CONTENT

    4Input Data Analysis: Statistics,

    Random Number Generation,Statistical Distribution and Fitting,

    Goodness of Fit Tests

    4Verification and Validation4Analysis of Simulation Output Data4Comparison of Simulated Model Results

    4Optimization of Simulated Models4Simulation Applications via ARENA

  • 8/13/2019 Lecture 1 - random number generation

    21/40

    bengu, c1/Simulation with Arena

    Fundamental Simulation Concepts Bengu, C1/21

    Popularity (contd.)

    u (A)IIE, O.R. division members (1980)

    Y First in utility and interest: Simulation

    Y But first in familiarity: LP (simulation was second)

    uLongitudinal study of corporate practice (1983, 1989, 1993)1. Statistical analysis

    2. Simulation

    uSurvey of such surveys (1989)

    Y Consistent heavy use of simulation

  • 8/13/2019 Lecture 1 - random number generation

    22/40

    bengu, c1/Simulation with Arena

    Fundamental Simulation Concepts Bengu, C1/22

    Popularity

    uM.S. grads, CWRU O.R. Department (1978)

    Y Asked about valueaftergraduation; rankings:

    1. Statistical analysis, 2. Forecasting, 3. Systems analysis,

    4. Information systems,5. Simulation

    u137 large firms (1979)

    1. Statistical analysis (93% used it)

    2. Simulation(84%)

    Y Followed by LP, PERT/CPM, inventory, NLP

  • 8/13/2019 Lecture 1 - random number generation

    23/40

    bengu, c1/Simulation with Arena

    Fundamental Simulation Concepts Bengu, C1/23

    Discrete SystemsPRODUCTION SYSTEMS,

    BANK, HOSPITALS

    0

    1

    23

    Number of Entities in System

    0

    5

    10

    1st Qtr 2nd Qtr 3rd Qtr

    Gas Level in Tank

    State variables change at discrete

    points in time. These occurrenceschanging system status are called

    events.

    State variables change continuously

    over time. These changes are function

    of time.

    TYPE OF SYSTEMS

    Continuous SystemsWATER FLOWS INTO DAM

  • 8/13/2019 Lecture 1 - random number generation

    24/40

    bengu, c1/Simulation with Arena

    Fundamental Simulation Concepts Bengu, C1/24

    Different Kinds of Simulation

    uStatic vs.Dynamic P1V1= P2V2 ?Does time have a role in the model?

    uContinuous-change vs.D iscrete-change

    Can the state change continuously or only at discrete points in time?

    uDeterministic vs.Stochastic m= 5

    Is everything for sure or is there uncertainty?m= N orm(5,4)

    m= Ex(5)

    uMost operational models:

    Dynamic,Discrete-change,Stochastic

  • 8/13/2019 Lecture 1 - random number generation

    25/40

    bengu, c1/Simulation with Arena

    Fundamental Simulation Concepts Bengu, C1/25

    Advantages of Simulation

    uEliminate Blunders: Flexibility to model things as they are(even if messy and complicated)

    Avoid looking where the light is (a morality play):

    u Allows uncertainty,nonstationarityin modelingYThe only thing that s for sure: nothing is for sureY Danger of ignoring system variabilityY Model validity

    You re walking along in the dark and see someone on hands and knees searching the groundunder a street light.

    You: What s wrong? Can I help you?Other person: I dropped my car keys and can t find them.

    You: Oh, so you dropped them around here, huh?

    Other person: No, I dropped them over there. (Points into the darkness.)

    You: Then why are you looking here?

    Other person: Because this is where the light is.

  • 8/13/2019 Lecture 1 - random number generation

    26/40

    bengu, c1/Simulation with Arena

    Fundamental Simulation Concepts Bengu, C1/26

    Advantages of Simulation(contd.)

    uAdvances in computing/ cost ratiosY Estimated that 75% of computing power is used for various kinds of

    simulations

    Y Dedicated machines (e.g., real-time shop-floor control)

    uAdvances in simulation softwareY Far easier to use (GUIs)

    Y No longer as restrictive in modeling constructs (hierarchical, down to C)

    Y Statistical design & analysis capabilities

  • 8/13/2019 Lecture 1 - random number generation

    27/40

    bengu, c1/Simulation with Arena

    Fundamental Simulation Concepts Bengu, C1/27

    Benefits

    Introduction to Simulation Using SIMAN (McGraw Hill, 1995) lists the following benefits associated with simulation.

    k New policies, operating procedures, decision rules,organizational structures, information flows, etc., can be

    explored without disrupting ongoing operations.

    k New hardware designs, physical layouts, software

    programs, transportation systems, etc., can be testedbefore committing resources to their acquisition and/or

    implementation.

    k Hypotheses about how or why certain phenomena occur

    can be tested for feasibility.

  • 8/13/2019 Lecture 1 - random number generation

    28/40

    bengu, c1/Simulation with Arena

    Fundamental Simulation Concepts Bengu, C1/28

    Benefits (cont)

    k Time can be controlled: it can be compressed,

    expanded, etc., allowing us to speed up or slow

    down a phenomenon for study

    k Insight can be gained about which variables are

    most important to performance and how these

    variables interact.

    k Bottlenecks in material, information, and productflow can be identified.

  • 8/13/2019 Lecture 1 - random number generation

    29/40

    bengu, c1/Simulation with Arena

    Fundamental Simulation Concepts Bengu, C1/29

    Benefits (cont)

    k A simulation study can prove invaluable to

    understanding how the system really operates as

    opposed to how everyone thinks it operates.

    k In new situations, about which we have limitedknowledge and experience, can be manipulated

    in order to prepare for theoretical future events.

    k Simulation s great strength lies in its abilityto let us explore what if questions.

  • 8/13/2019 Lecture 1 - random number generation

    30/40

    bengu, c1/Simulation with Arena

    Fundamental Simulation Concepts Bengu, C1/30

    The Bad News

    uDont get exact answers, only approximations,estimates

    Y Also true of many other modern methods

    YCan bound errors by machine roundoff

    uGet random output(RIRO)from stochasticsimulations

    Y Statistical design, analysis of simulation experiments

    Y Exploit: noise control, replicability, sequential sampling,variance-reduction techniques

    YCatch: standard statistical methods seldom work

  • 8/13/2019 Lecture 1 - random number generation

    31/40

    bengu, c1/Simulation with Arena

    Fundamental Simulation Concepts Bengu, C1/31

    Simulation by Hand:The Buffon Needle Problem

    uEstimatep (George Louis Leclerc, c. 1733)

    uToss needle of lengthlonto table with stripesd(>l)apart

    uP (needle crosses a line) =

    uRepeat; tally = proportion of times a line is crossed

    uEstimatep by

    d

    l

    p

    2

    $p

    2l

    pd$

  • 8/13/2019 Lecture 1 - random number generation

    32/40

    bengu, c1/Simulation with Arena

    Fundamental Simulation Concepts Bengu, C1/32

    Why Toss Needles?

    Buffon needle problem seems silly now, but it hasimportant simulation features:

    Y Experiment to estimatesomething hard to compute exactly (in 1733)

    YRandomness, so estimate will not be exact; estimate the error in the

    estimate

    YReplication(the more the better) to reduce error

    YSequential samplingto control error -- keep tossing until probable error

    in estimate is small enoughYV ariance reduction(Buffon Cross)

  • 8/13/2019 Lecture 1 - random number generation

    33/40

    bengu, c1/Simulation with Arena

    Fundamental Simulation Concepts Bengu, C1/33

    Using Computers to Simulate

    uGeneral-purpose languages(C++. C, FORTRAN, JAVA )

    YTedious, low-level,time consumingto develop,error-prone

    Y But, almost completeflexibilityand computation speed

    uSupport packagesY Subroutines for list processing, bookkeeping, time advance

    Y Widely distributed, widely modified

    uSpreadsheets

    Y Usually static modelsY Financial scenarios, distribution sampling, SQC

  • 8/13/2019 Lecture 1 - random number generation

    34/40

    bengu, c1/Simulation with Arena

    Fundamental Simulation Concepts Bengu, C1/34

    Using Computers to Simulate(contd.)

    uSimulation languages

    Y GPSS, SIMSCRIPT, SLAM, SIMAN,ARENA,

    SIMFACTORY, PROMODEL, AUTOMOD, WITNESS,..

    Y Popular, in wide use todayY Learning curve for features, effective use, syntax

    uHigh-level simulators

    Y Very easy, graphical interface

    Y Domain-restricted (manufacturing, communications)

    Y Limited flexibility model validity?

  • 8/13/2019 Lecture 1 - random number generation

    35/40

    bengu, c1/Simulation with Arena

    Fundamental Simulation Concepts Bengu, C1/35

    Where Arena Fits In

    ArenaTemplate

    StandardEdition P

    rofessionalEdition

    A singlegraphical userinterfaceconsistent atany level ofmodeling

    Higher

    Level ofModeling

    Lower

    SIMAN

    Template

    VerticalSolutions

    User-Created TemplatesCommonly used constructsCompany-specific processesCompany-specific templatesetc.

    Application Solution TemplatesCall$imBP$imetc.

    Common Panel

    Many common modeling constructsVery accessible, easy to useReasonable flexibility

    Support, Transfer PanelsAccess to more detailed modeling for greater

    flexibility

    Blocks, Elements PanelsAll the flexibility of the SIMAN simulation

    language

    User-Written Visual Basic, C/C++, FORTRANCode

    The ultimate in flexibilityC/C++/FORTRAN requires compiler

    u Hierarchical structure

    Y Multiple levels ofmodeling

    Y Can mix differentmodeling levels togetherin the same model

    Y Often, start high then golower as needed

    u Get ease-of-useadvantage of simulatorswithout sacrificingmodeling flexibility

  • 8/13/2019 Lecture 1 - random number generation

    36/40

    bengu, c1/Simulation with Arena

    Fundamental Simulation Concepts Bengu, C1/36

    When Simulations are Used

    uUses of simulation have evolved with hardware,software

    uThe early years (1950s-1960s)

    Y Very expensive, specialized tool to useY Required big computers, special training

    Y Mostly in FORTRAN (or even Assembler)

    Y Processing cost as high as $1000/ hour for a sub-286 level machine

  • 8/13/2019 Lecture 1 - random number generation

    37/40

    bengu, c1/Simulation with Arena

    Fundamental Simulation Concepts Bengu, C1/37

    When Simulations are Used (contd.)

    uThe formative years (1970s-early 1980s)

    Y Computers got faster, cheaper

    Y Value of simulation more widely recognized

    Y Simulation software improved, but they were still languages to be

    learned, typed, batch processed

    Y Often used to clean up disasters in auto, aerospace industries

    4Car plant; heavy demand for certain model

    4 Lineunderperforming

    4 Simulated, problem identified

    4 But demand had dried up simulation was too late

  • 8/13/2019 Lecture 1 - random number generation

    38/40

    bengu, c1/Simulation with Arena

    Fundamental Simulation Concepts Bengu, C1/38

    When Simulations are Used (contd.)

    The recent past (late 1980s)

    YMicrocomputer power

    Y Software expanded into GUIs, animation

    YWider acceptance across more areas4Traditional manufacturing applications

    4 Services

    4Health care

    4 Business processes

    Y Still mostly in large firms

    YOften a simulation is part of the specs

  • 8/13/2019 Lecture 1 - random number generation

    39/40

    bengu, c1/Simulation with Arena

    Fundamental Simulation Concepts Bengu, C1/39

    When Simulations are Used (contd.)

    uThe present

    Y Proliferating into smaller firms

    Y Becoming a standard tool

    Y Being used earlier in design phaseY Real-time control

    uThe future

    Y Exploiting interoperability of operating systems

    Y Specialized templates for industries, firms

    Y Automated statistical design, analysis

  • 8/13/2019 Lecture 1 - random number generation

    40/40

    bengu, c1/Simulation with Arena

    Fundamental Simulation Concepts Bengu, C1/40

    SYSTEM STATE

    VARIABLES

    EVENTS ENTITIES ATTRIBUT

    ES

    ACTIVITIE

    S

    Banking # busy tellers# customers

    waiting

    1.Arrival of Customer

    2.Departure of Customer

    Customers ServiceTime

    Makingdeposit

    and

    withdrawal

    Inventory Level of

    inventoryBacklogged

    demands

    1. Demand for

    Inventory2. Review of

    Inventory

    3. Arrival of

    Inventory

    Inventoried

    Items

    Capacity

    Mfg

    Examples