Literature Review
Define Computational Science: The Discipline of Computer Simulation.
Computational science is a field that uses mathematical modeling and computer simulation to study and understand complex phenomena in various scientific and engineering disciplines. It integrates mathematical analysis, numerical methods, and high-performance computing to solve problems that are difficult or impossible to tackle with traditional theoretical or experimental approaches
Computer simulation imitates the operation of a system and its internal processes, usually over time, and in appropriate detail to draw conclusions about the system’s behavior. Simulation models are created using software designed to represent common system components, and record how they behave over time. Simulation is used for predicting both the effect of changes to existing systems, and the performance of new systems. Simulations are frequently used in the design, emulation, and operation of systems.
Simulations may be stochastic or deterministic. In a stochastic simulation (the most common), randomness is introduced to represent the variation found in most systems. Activities involving people always vary (for example in time taken to complete a task or quality of performance); external inputs (such as customers and materials) vary; and exceptions (failures) occur. Deterministic models have no variation. These are rare in design applications, but more common in model-based decision support such as scheduling and emulation applications..
There are two main types of simulation, discrete and continuous. The terms discrete and continuous refer to the changing nature of the states within the system. Some states (e.g., the length of a queue, status of a worker) can change only at discrete points in time (called event times). Other states (e.g., pressure in a tank or temperature in an oven) can change continuously over time. Some systems are purely discrete or continuous, while others have both types of states present.
Continuous systems are defined by differential equations that specify the rate of change. Simulation software uses numerical integration to generate a solution for the differential equations over time. System dynamics is a graphical approach for creating simple models using the same underlying concept, and is often used to model population dynamics, market growth/decay, and other relationships based on equations.
Three discrete modeling paradigms have evolved in simulation. Events model the points in time when the system state changes (a customer arrives or departs). Processes model a sequence of actions that take place over time (a part in a manufacturing system seizes a worker, delays by a service time, then releases the worker). Objects allow more intuitive modeling by representing complete objects found in the facility. Agent-based modeling (ABM) is a special case of the object paradigm in which the system behavior emerges from the interaction of a large number of autonomous intelligent objects (such as soldiers, firms in a market, or infected individuals in an epidemic). The distinction between these paradigms is somewhat blurred because modern packages incorporate multiple paradigms. Simio is a multi-paradigm modeling tool that incorporates all these paradigms into a single framework. You can use a single paradigm, or combine multiple paradigms in the same model. Simio combines the ease and rapid modeling of objects with the flexibility of processes.
Simulation has been applied to a huge variety of settings. The following are just a few samples of areas where simulation has been used to understand and improve the system effectiveness:
- Airports: Parking-lot shuttles, ticketing, security, terminal transportation, food court traffic, baggage handling, gate assignments, airplane de-icing.
- Hospitals: Emergency department operation, disaster planning, ambulance dispatching, regional service strategies, resource allocation.
- Ports: Truck and train traffic, vessel traffic, port management, container storage, capital investments, crane operations.
- Mining: Material transfer, labor transportation, equipment allocation, bulk material mixing.
- Amusement parks: Guest transportation, ride design/startup, waiting line management, ride staffing, crowd management.
- Call centers: Staffing, skill-level assessment, service improvement, training plans, scheduling algorithms.
- Supply chains: Risk reduction, reorder points, production allocation, inventory positioning, transportation, growth management, contingency planning.
- Manufacturing: Capital-investment analysis, line optimization, product-mix changes, productivity improvement, transportation, labor reduction.
- Military: Logistics, maintenance, combat, counterinsurgency, search and detection, humanitarian relief.
- Telecommunications: Message transfer, routing, reliability, network security against outages or attacks.
- Criminal-justice system: Probation and parole operations, prison utilization and capacity.
- Emergency-response system: Response time, station location, equipment levels, staffing.
- Public sector: Allocation of voting machines to precincts.
- Customer service: Direct-service improvement, back-office operations, resource allocation, capacity planning.
Far from being a tool for manufacturing only, the domains and applications of simulation are wide-ranging and virtually limitless.
A queueing system is one in which entities (like customers, patients, jobs, or messages) arrive, get served either at a single station or at several stations in turn, might have to wait in one or more queues for service, and then may leave (if they do leave the system is called open, but if they never leave and just keep circulating around within the system it’s called closed).
The urgent-care clinic described earlier, is modeled as an open queueing system. There are five separate service stations (Sign In, Registration, Trauma Rooms, Exam Rooms, and Treatment Rooms), each of which could be called a node in a network of multiserver queueing nodes (Registration has just a single server, but that’s a special case of multiserver). If there are multiple individual parallel servers at a queueing node (e.g., three for Exam Rooms), a single queue “feeds” them all, rather than having a separate queue for each single server, and we usually assume that the individual servers are identical in terms of their capabilities and service rates. The numbers by the arcs in give the probabilities that patients will follow those arcs. When coming out of a station where there’s a choice about where to go next (out of Sign In and Exam Rooms) we need to know these probabilities; when coming out of a station where all patients go to the same next station (out of Arrival, Registration, Trauma Rooms, Treatment Rooms) the 1.0 probabilities noted in the arcs are obvious, but we show them anyway for completeness. Though terminology varies, we’ll say that an entity is in queue if it’s waiting in the line but not in service, so right now at the Exam Rooms in Figure 2.1 there are four patients in queue and seven patients in the Exam-Room system; there are three patients in service at the Exam Rooms.
When a server finishes service on an entity and there are other entities in queue for that queueing node, we need to decide which specific entity in queue will be chosen to move into service next — this is called the queue discipline. You’re no doubt familiar with first-come, first-served (better known in queueing as first-in, first-out, or FIFO), which is common and might seem the “fairest.” Other queue disciplines are possible, though, like last-in, first-out (LIFO), which might represent the experience of chilled plates in a stack waiting to be used at a salad bar; clean plates are loaded onto the top, and taken from the top as well by customers. Some queue disciplines use priorities to pay attention to differences among entities in the queue, like shortest-job-first (SJF), also called shortest processing time (SPT). With an SJF queue discipline, the next entity chosen from the queue is one whose processing time will be lowest among all those then in queue (you’d have to know the processing times beforehand and assign them to individual entities), in an attempt to serve quickly those jobs needing only a little service, rather than making them wait behind jobs requiring long service, thereby hopefully improving (reducing) the average time in queue across all entities. Pity the poor big job, though, as it could be stuck near the back of the queue for a very long time, so whether SJF is “better” than FIFO might depend on whether you care more about average time in system or maximum (worst) time in system. A kind of opposite of SJF would be to have values assigned to each entity (maybe profit upon exiting service) and you’d like to choose the next job from the queue as the one with the highest value (time is money, you know). In a health-care system like that in Figure 2.1, patients might be initially triaged into several acuity levels, and the next patient taken from a queue would one in the most serious acuity-level queue that’s non-empty; within each acuity-level queue a tie-breaking rule, such as FIFO, would be needed to select among patients at the same acuity level.
Several performance measures (or output metrics) of queueing systems are often of interest:
- The time in queue is, as you’d guess, the time that an entity spends waiting in line (excluding service time). In a queueing network like Figure 2.1, we could speak of the time in queue at each station separately, or added up for each patient over all the individual times in queue from arrival to the system on the upper left, to exit on the far right.
- The time in system is the time in queue plus the time in service. Again, in a network, we could refer to time in system at each station separately, or overall from arrival to exit.
- The number in queue (or queue length) is the number of entities in queue (again, not counting any entities who might be in service), either at each station separately or overall in the whole system. Right now in Figure 2.1 there are two patients in queue at Sign In, one at Registration, four at Exam Rooms, and none at both Trauma Rooms and Treatment Rooms; there are seven patients in queue in the whole system.
- The number in system is the number of entities in queue plus in service, either at each station separately or overall in the whole system. Right now in Figure 2.1 there are four patients in system at Sign In, two at Registration, seven at Exam Rooms, one at Trauma Rooms, and two at Treatment Rooms; there are 16 patients in the whole system.
https://textbook.simio.com/SASMAA7/ch-data.html
Significance of the Study
Bigger, more computationally intensive models became possible with every new generation of computers. For 20 years at least, this boost in computing power was essentially free for the software developer; at most, a new compiler was required and possibly a few modifications of the source code to suit some of its quirks. So, with only a modest effort, the new, more powerful computers ran existing models faster or larger models in a reasonable amount of time. This ended when the microscopic parts of the computer could not be made any smaller. Now each new generation of computer contains processors with essentially the same computing capabilities as those of the previous generation; the new computers just have more of them.
In the field of numerical scientific programming, there are many languages being used, with most scientists opting for Matlab®,1 C/C++or Fortran. The first and most compelling reason for using C++ (as well as C and Fortran) is because they are fast. That is, with careful programming and optimization, they can be compiled to a machine code program which is able to use the full power of the available hardware. Many scripting languages (such as Matlab and Python) are interpreted languages, meaning that the code which you write is translated to machine code at run time. Other modern languages (such as Java and C#) compile halfway—toahardware-independentbyte-codewhichistheninterpretedatruntime. Run time interpretation means that some of the computer’s power is spent on the conversion process and also that it is harder to apply optimization. Nowadays Mat lab, Python and Java implementations use clever tricks such as caching compilation steps and just-in-time compilation to make programs run faster. Nevertheless, these tricks require computational effort and so these languages may not fully utilize the power of all hardware. A second reason for using C++ is that there is a wealth of numerical libraries for scientific computing in C++ and related languages. Lots of numerical algorithms were established in the 1950s and were then incorporated into software libraries (such as EISPACK and LINPACK) in the 1970s.
If you write your own code using well-established, well-tested software then you are building on decades of experience and improvement. A third reason for choosing to write in C++ is that there is a wide-range of open source and commercial tools to support you. We used the free GNU compiler tool-set to test the programs in this book and you can use any C++ compiler to compile them for your computer. In contrast, if we were distributing Matlab programs, you would need to have Matlab and a license installed on your computer because it is a proprietary product. There are similar open source products (such as GNU Octave) but there is no guarantee that Matlab program will produce the same answer when run in Octave. Because it is closed source, the meaning of a program can change between versions of Matlab. For example, when just-in-time compilation was introduced in Matlab 7the operational semantics of the language subtly changed. This meant that a small minority of Matlab programs which were known to work well with one checking built in.
The Version of Matlab could produce incorrect results, errors or warnings on another version. A fourth reason for C++ is that it has a flexible memory management model.Ina Java program, some of the system memory is used in the interpretation and you rely on a garbage collector to tidy up memory which you are no longer using, and so you may not be able to predict how much memory a program is going to need. In C++ you can make this prediction, but this is a double-edged sword because you are also responsible for making sure that memory is managed properly. A final reason to program in C++ is that it is an object-oriented language. We haven’t yet told you what this means exactly, but it is widely held that writing in an object-oriented style leads to programs which are easier to understand, to extend, to maintain and to refactor
Many scientific programmers believe that Fortran will always give the best performance in terms of raw speed and would reject C++ on the basis that features such as pointer chasing and virtual method look-up (don’t worry if you haven’t heard of these terms, or don’t know what they mean—you may never need to!) result in the code being executed at suboptimal speed. This may have some truth, but the fact that object-orientation leads to greater readability (as mentioned above) makes it a reasonable compromise language. It can be a very fast language and it is also a good language for readability
Some languages are better for writing prototype programs or for plotting data. Matlab excels in the field of rapid prototyping—short programs to quickly explore some algorithm or phenomenon. To test a particular linear algebra algorithm on a range of matrice swith various sizes and structures would take a few lines of Matlab, but in C++ you might have to write several files and compile against someone else’s libraries. Matlabalsohastheadvantageofafully-integratedgraphicaldevelopment environment, making many programming tasks easy without having to rely on extra tools. Furthermore, Matlab has an in-built plotting environment, so if you want to visualize the results of your algorithms quickly Matlab might be your best choice. So C++may not be the best choice of language in every situation. However, there are many situations in which C++ has the ideal fit for a particular problem. The discussion above may be enough to convince you that it is worth getting started with C++
https://petcomputacao.ufsc.br/wp-content/uploads/2020/06/2017_Book_GuideToScientificComputingInC.pdf
For thirty years from its inception through Fortran and Fortran Fortran has been the principal language of computational science During this time Fortrans numerical capabilities have been remarkably stable and superior to that of other computer languages the biggest changes have come in the form of increasingly diverse and reliable libraries of numerical routines The union of Fortran techniques for its use and the extensive numerical libraries characterize the predominant infrastructure for computational science In the past decade however the increasing importance of dynamic data structures particularly dynamic arrays Unix workstations sophisticated interactive visualization facilities and more recently parallel architectures none of which Fortran accommodates well has spurred interest in the use of other languages for computation languages most notably C Recently C has also garnered considerable interest and Fortran has attempted to ad dress its deficiencies for modern computational science by evolving to Fortran A general attempt is made in this section to compare the relative suitability to computational science of these four languages two favors of C C and C and Fortran and two favors of Fortran
Fortran has a very practical easy-to-use data abstraction capability C as an important part of object oriented programming also has cant data abstraction capabilities For computational science much advantage can be obtained from data abstraction without the additional complexities of object oriented programming and therefore a slight edge is given to Fortran and C in this area Both Fortran and C fall far short of both Fortran here though C is given the nod over Fortran structures Object Oriented Programming Because Fortran because of Cs support of data does not support automatic inheritance C language along this dimension Fortran s is clearly the superior polymorphic generic features give it a manual rather than automatic inheritance capability which places it ahead of both C and Fortran Again the data structuring capabilities of C place it ahead of Fortran area Functional Programming Because of the lack of recursion and data structures Fortran in this general is clearly last in this category also The other three languages all have these essential aspects for functional programming Of the three however only Fortran allows lazy evaluation standard C and hence C species a sequence point between function argument evaluation and evaluation of the function itself precluding lazy evaluation of function arguments Thus Fortran must be ranked first of the four in this category Polymorphism is also important in functional programming and C is superior to C in this regard Numerical Robustness In many respects numerical computation is the heart of computational science as much of computational science involves the numerical simulation of mathematical models Good numerical facilities are therefore key Traditionally available numerical facilities have consisted primarily of single and double precision real data types complex data type single precision only and rich libraries of functions providing a wide range of specific numerical computations Occasionally additional capabilities such as double precision complex or quadruple precision real numeric data types are encountered These traditional numeric facilities are adequate for a great many computational science applications In some cases however better selection of the numeric precision of an operand or more information about the current numeric implementation environment than is available from the traditional tools is needed to guarantee convergence yield the most accurate result o
provide some other form of robustness of the numerical computation The rest of these better selection of numeric precision is provided by the Fortran type kind mechanism and the ability to make user and implementation de need functions generic over different kinds of arguments The second information about the numeric environment is provided by the numeric approximation model and the corresponding inquiry intrinsic functions that return environmental information related to this model The next three subsections describe the rest of these two enhancements to numerical robustness and the last two subsections describe the second one
https://ergodic.ugr.es/cphys/lecciones/FORTRAN/pl.pdf
Reference:
https://textbook.simio.com/SASMAA7/ch-data.html
https://petcomputacao.ufsc.br/wp-content/uploads/2020/06/2017_Book_GuideToScientificComputingInC.pdf