

\documentclass{beamer}

% This file is a solution template for:

% - Talk at a conference/colloquium.
% - Talk length is about 20min.
% - Style is ornate.



% Copyright 2004 by Till Tantau <tantau@users.sourceforge.net>.
%
% In principle, this file can be redistributed and/or modified under
% the terms of the GNU Public License, version 2.
%
% However, this file is supposed to be a template to be modified
% for your own needs. For this reason, if you use this file as a
% template and not specifically distribute it as part of a another
% package/program, I grant the extra permission to freely copy and
% modify this file as you see fit and even to delete this copyright
% notice. 


\mode<presentation>
{
  %\usetheme{Madrid}
  \usetheme{Warsaw}
  % or ...
  %\usetheme{Berkeley}   % left bar
  %\usetheme{Antibes} % tree header
  %\usetheme{Boadilla}  % very plain
  %\usetheme{Warsaw}
  %\usetheme{Rochester} % I like
  %\usetheme{Goettingen}  % right bar
  %\usetheme{Ilmenau}

\usecolortheme{lily}

  %\usepackage{beamerouterthemeshadow}
  %\usepackage{beamerouterthemesmoothtree}
  \usepackage{beamercolorthemeorchid}
  %\usepackage{beamerinnerthemerounded}
  %\usepackage{beamerthemeshadow}
  \setbeamercovered{transparent}
  % comment out to completely hide covered material



  %\setbeamercovered{transparent}
  % or whatever (possibly just delete it)
}

\usepackage{wmff}

\usepackage[english]{babel}
% or whatever

\usepackage[latin1]{inputenc}
% or whatever

\usepackage{times}
\usepackage[T1]{fontenc}
% Or whatever. Note that the encoding and the font should match. If T1
% does not look nice, try deleting the line with the fontenc.


\title % (optional, use only with long paper titles)
{Object Oriented Modeling and Simulation}

\subtitle
{Using Queues in OOSimL}

\author%[Author, Another] % (optional, use only with lots of authors)
{Jos\'e M. Garrido C.}
% \inst{1} 
% \and S.~Another\inst{2}}
% - Give the names in the same order as the appear in the paper.
% - Use the \inst{?} command only if the authors have different
%   affiliation.

\institute[Kennesaw State University] % (optional, but mostly needed)
{
  %\inst{1}%
  Department of Computer Science\\College of Computing and Software Engineering\\
  Kennesaw State University
%  \and
%  \inst{2}%
%  Department of Theoretical Philosophy\\
%  University of Elsewhere
}
% - Use the \inst command only if there are several affiliations.
% - Keep it simple, no one is interested in your street address.

\date % (optional, should be abbreviation of conference name)
{Spring, 2017}
% - Either use conference name or its abbreviation.
% - Not really informative to the audience, more for people (including
%   yourself) who are reading the slides online

\subject{Applied Computer Science, Simulation}
% This is only inserted into the PDF information catalog. Can be left
% out. 



% If you have a file called "university-logo-filename.xxx", where xxx
% is a graphic format that can be processed by latex or pdflatex,
% resp., then you can add a logo as follows:

%\pgfdeclareimage[height=0.17in]{university-logo}{ksu-1.png}
%\logo{\pgfuseimage{university-logo}}



% Delete this, if you do not want the table of contents to pop up at
% the beginning of each subsection:
%\AtBeginSubsection[]
%{
%  \begin{frame}<beamer>{Outline}
%    \tableofcontents[currentsection,currentsubsection]
%  \end{frame}
%}


% If you wish to uncover everything in a step-wise fashion, uncomment
% the following command: 

%\beamerdefaultoverlayspecification{<+->}


\begin{document}

\begin{frame}
  \titlepage
\end{frame}

%\begin{frame}{Outline}
%  \tableofcontents
  % You might wish to add the option [pausesections]
%\end{frame}


% Structuring a talk is a difficult task and the following structure
% may not be suitable. Here are some rules that apply for this
% solution: 

% - Exactly two or three sections (other than the summary).
% - At *most* three subsections per section.
% - Talk about 30s to 2min per frame. So there should be between about
%   15 and 30 frames, all told.

% - A conference audience is likely to know very little of what you
%   are going to talk about. So *simplify*!
% - In a 20min talk, getting the main ideas across is hard
%   enough. Leave out details, even if it means being less precise than
%   you think necessary.
% - If you omit details that are vital to the proof/implementation,
%   just say so once. Everybody will be happy with that.

%\section{}

\begin{frame}{Types of Queues}
 \begin{block}{}
OOsimL provides two general types of queues to store references to processes in  simulation models; these are: 
\begin{itemize}
\item
 simple queues 
\item
 priority queues
\end{itemize}
\end{block}
\begin{block}{}
 These queues are data structures that store references to processes. These references are inserted to the {\em tail\/} of the queue and removed from the {\em head} of the queue.
\end{block}
\end{frame}

\begin{frame}{Illustration of a Queue}
\begin{figure}
\center
\includegraphics[width=3.55in]{figs/queue.png}
\caption{A queue}
\label{fig:tqueue}
%\vskip\baselineskip
\end{figure}
\end{frame}

\begin{frame}{Simple Queues}
\begin{block}{}
To use simple queues in an OOSimL program, one or more objects of class {\em Squeue} must be created. These objects are simple first-in-first-out (FIFO) queues.
\end{block}
\begin{block}{} 
 The {\bf create} statement is used for creating a simple queue requires the name of the queue and the queue size (queue capacity). This last data item is optional; if not included, the assigned default size is 1,000. 
\end{block}
\end{frame}

\begin{frame}[fragile]{Example Creating Queues}
\begin{block}{}
 The following lines of code declare and create a simple queue, {\em custQueue} with an assigned name ``Customer Queue'' and size of 15 customers.
\end{block}
\begin{block}{}

{\tt \small
\begin{verbatim}
 define cust_queue of class Squeue // declare queue
 ...
 // now create simple queue
 create custQueue of class Squeue using 
       ``Customer Queue'', 15  
\end{verbatim}
}
\end{block}
\end{frame}



\begin{frame}[fragile]{Check Queue Full}
 \begin{block}{}
To check for the general states of the queue, empty or full, conditions {\bf full} and  {\bf empty} are provided. An {\bf if} statement is used with these boolean values (true or false). 
  \end{block}
 \begin{block}{} 
The following lines of code check if queue object {\em cust\_queue} (defined above) is full.
 
{\tt \small
\begin{verbatim}
 if cust_queue is full then
    // if queue is full execute instructions here
    ...
 else
    // queue is not full
    ...
 endif
\end{verbatim}
}
 \end{block} 
\end{frame}



\begin{frame}[fragile]{Check Queue Empty} 
 \begin{block}{}
 In a similar manner, the {\bf if} statement with the {\bf empty} condition checks if a queue is empty. 
  \end{block}
  \begin{block}{} 
  The following lines of code check if queue object referenced by {\em cust\_queue} (defined above) is empty. The process suspends itself if the queue is empty, otherwise, it proceeds to dequeue an object from the queue.

{\tt \small
\begin{verbatim}
  if cust_queue is empty then
     // if queue is empty, suspend here
     suspend self
  else
     // dequeue object
     ...
  endif
\end{verbatim}
}

\end{block}  
\end{frame}

\begin{frame}{Length of Queue} 
 \begin{block}{}
The {\bf assign length} statement gets the current number of objects in the specified queue (current queue size). 

The general structure of the statement follows.

%\vspace{0.1in}
{\tt %\footnotesize
\begin{algorithm}
{\bf assign length of} $\langle$ queue\_ref $\rangle$ {\bf to} $\langle$ variable $\rangle$
\end{algorithm}
}
\end{block}
\end{frame}



\begin{frame}[fragile]{Example Length of Queue}
\begin{block}{}

The following lines of code get the current length of the queue object referenced by {\em cust\_queue} (defined above) and assigns it to variable {\em qlength}.
 
{\tt \small
\begin{verbatim}
define qlength of type integer
. . .
assign length of cust_queue to qlength
\end{verbatim}
}
\end{block}
\end{frame}
 

\begin{frame}{Insert Object Into Queue}
\begin{block}{}
The {\bf insert} statement inserts the object specified to the tail of the queue. The inserted object becomes the new object at the tail of the queue. The size of the queue is increased by one. The general structure of the statement follows.

\vspace{0.1in}
%\begin{quote}
{\tt %\footnotesize
\begin{algorithm}
{\bf insert} $\langle$ ref\_variable $\rangle$ {\bf into} $\langle$ queue\_ref $\rangle$ \\
{\bf insert self into} $\langle$ queue\_ref $\rangle$ \\
{\bf enqueue} $\langle$ ref\_variable $\rangle$ {\bf into} $\langle$ queue\_ref $\rangle$ \\
{\bf enqueue self into} $\langle$ queue\_ref $\rangle$ 
\end{algorithm}
}
%\end{quote}
\vspace{0.1in}
 \end{block}
\end{frame}

\begin{frame}[fragile]{Example Queue Insertion}
\begin{block}{}
The following lines of code insert (enqueue) the object referenced by  {\em cust\_obj} into  the simple queue referenced by {\em cust\_queue}.
 
%\begin{quote}
{\tt \small
\begin{verbatim}
  define cust_obj of class Customer  
  ...
  // enqueue customer process
  insert cust_obj into cust_queue   
\end{verbatim}
}
\end{block}
\end{frame}


\begin{frame}{Remove Object from a Queue}
\begin{block}{}
 The {\bf remove} statement dequeues (removes) the process at the head of from the specified simple queue. After removal, the size of the queue is reduced by one, as a result of this operation. The general forms of the statement are:

\vspace{0.1in}
%\begin{quote}
{\tt \small
\begin{algorithm}
{\bf remove} [{\bf object}] $\langle$ ref\_var $\rangle$ {\bf of class} $\langle$ cl\_name $\rangle$ \\
\ \ \ \ {\bf from} [{\bf queue}] $\langle$ queue\_ref $\rangle$ \\
{\bf dequeue} [{\bf object}] $\langle$ ref\_var $\rangle$ {\bf of class} $\langle$ cl\_name $\rangle$ \\
\ \ \ \ {\bf from} [{\bf queue}] $\langle$ queue\_ref $\rangle$
\end{algorithm}
}
%\end{quote}
 \end{block}
\end{frame}

\begin{frame}[fragile]{Example Queue Removal}
\begin{block}{}
The following line of code removes (dequeues) a customer process from the head of the queue referenced by {\em cust\_queue} and assigns it to reference {\em cust\_obj}. 
 
%\begin{quote}
{\tt \small
\begin{verbatim}
remove object cust_obj of class Customer from 
       queue cust_queue
\end{verbatim}
}
\end{block}
\end{frame}

\begin{frame}{Get Object from a Queue}
\begin{block}{}
The {\bf get} statement gets a copy of the process at the head of the specified simple queue, without removing it from the queue. The general form of the statement follows.

\vspace{0.1in}
%\begin{quote}
{\tt \small
\begin{algorithm}
{\bf get} [{\bf object}] $\langle$ ref\_var $\rangle$ {\bf of class} $\langle$ cl\_name $\rangle$ \\
\ \ \ \ {\bf from} [{\bf queue}] $\langle$ queue\_ref $\rangle$
\end{algorithm}
}
\end{block}
\end{frame}

\begin{frame}[fragile]{Example Queue Removal}
\begin{block}{}
The following line of code gets a copy of a customer process from the head of the queue referenced by {\em cust\_queue} and assigns it to reference {\em cust\_obj}. 
 
{\tt \small
\begin{verbatim}
get object cust_obj of class Customer from
      queue cust_queue
\end{verbatim}
}
\end{block}
\end{frame}

\begin{frame}{Priority Queues}
\begin{block}{}
\begin{itemize}
  \item 
Priority queues allow the simulation model to retrieve or remove objects from the queue, based on the priority of the objects or processes. 
\item As such, priority queues do not behave as FIFO queues. 
\item A priority queue is an object of class {\em Pqueue}. 
\end{itemize}
\end{block}
\end{frame}

\begin{frame}{Creating Priority Queues}
\begin{block}{}

The {\bf create} statement is used to create a priority queue and requires:
\begin{itemize}
  \item 
 the name of the queue
 \item the optional number of different priorities; if this argument is not included, the number of priorities is assigned to 300 (default)
 \item the queue size for all priorities, which is also optional and the assigned default queue size is 1,000 for every priority. 
\end{itemize}
\end{block}
\end{frame}

\begin{frame}[fragile]{Example Creating a Priority Queue}
\begin{block}{}
The following lines of code declare and create the priority queue with reference name {\em cust\_queue}, with queue name ``Customer Queue'', using 8 different priorities, and size (capacity) of 25 customers for every priority.
 
%\begin{quote}
{\tt \small
\begin{verbatim}
define cust_queue of class Pqueue    
...
// create priority queue
create cust_queue of class Pqueue using 
      ``Customer Queue'', 8, 25
\end{verbatim}
}
\end{block}
\end{frame}

\begin{frame}{Insert Object Into Priority Queue}
\begin{block}{}
The {\bf insert} statement inserts the specified object into the priority queue. The size of the queue is increased by one. The priority of the process is automatically taken from the object to be inserted. The general forms of the statement are:

\vspace{0.1in}
%\begin{quote}
{\tt \small
\begin{algorithm}
{\bf insert} $\langle$ ref\_variable $\rangle$ {\bf into} $\langle$ queue\_ref $\rangle$ \\
% \ \ \ \ {\bf with priority} $\langle$ prio\_var $\rangle$
{\bf insert self into} $\langle$ queue\_ref $\rangle$ \\
% {\bf with priority} $\langle$ prio\_var $\rangle$
{\bf enqueue} $\langle$ ref\_variable $\rangle$ {\bf into} $\langle$ queue\_ref $\rangle$ \\
% \ \ \ \ {\bf with priority} $\langle$ prio\_var $\rangle$
{\bf enqueue self into}$\langle$ queue\_ref $\rangle$
% {\bf with priority} $\langle$ prio\_var $\rangle$
\end{algorithm}
}

\end{block}
\end{frame}

\begin{frame}[fragile]{Example Inserting to a Priority Queue}
\begin{block}{}
The following lines of code insert (enqueue) object {\em cust\_obj} into priority queue {\em pcust\_queue}.
 
%\begin{quote}
{\tt \small
\begin{verbatim}
 define cust_prio = 3 of type integer
 define cust_obj of class Customer  // reference customer
 ...
 // enqueue customer process
 insert cust_obj into pcust_queue 
\end{verbatim}
}
\end{block}
\end{frame}


%\subsection{Basic Ideas for Proofs/Implementation}

\end{document} 




