\documentclass[12pt,titlepage]{article}

\usepackage{amsmath}
\usepackage{mathrsfs}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{mathtools}
\usepackage{graphicx}
\usepackage{color}
\usepackage{ucs}
\usepackage[utf8x]{inputenc}
\usepackage{xparse}
\usepackage{hyperref}

%----Macros----------
%
% Unresolved issues:
%
%  \righttoleftarrow
%  \lefttorightarrow
%
%  \color{} with HTML colorspec
%  \bgcolor
%  \array with options (without options, it's equivalent to the matrix environment)

% Of the standard HTML named colors, white, black, red, green, blue and yellow
% are predefined in the color package. Here are the rest.
\definecolor{aqua}{rgb}{0, 1.0, 1.0}
\definecolor{fuschia}{rgb}{1.0, 0, 1.0}
\definecolor{gray}{rgb}{0.502, 0.502, 0.502}
\definecolor{lime}{rgb}{0, 1.0, 0}
\definecolor{maroon}{rgb}{0.502, 0, 0}
\definecolor{navy}{rgb}{0, 0, 0.502}
\definecolor{olive}{rgb}{0.502, 0.502, 0}
\definecolor{purple}{rgb}{0.502, 0, 0.502}
\definecolor{silver}{rgb}{0.753, 0.753, 0.753}
\definecolor{teal}{rgb}{0, 0.502, 0.502}

% Because of conflicts, \space and \mathop are converted to
% \itexspace and \operatorname during preprocessing.

% itex: \space{ht}{dp}{wd}
%
% Height and baseline depth measurements are in units of tenths of an ex while
% the width is measured in tenths of an em.
\makeatletter
\newdimen\itex@wd%
\newdimen\itex@dp%
\newdimen\itex@thd%
\def\itexspace#1#2#3{\itex@wd=#3em%
\itex@wd=0.1\itex@wd%
\itex@dp=#2ex%
\itex@dp=0.1\itex@dp%
\itex@thd=#1ex%
\itex@thd=0.1\itex@thd%
\advance\itex@thd\the\itex@dp%
\makebox[\the\itex@wd]{\rule[-\the\itex@dp]{0cm}{\the\itex@thd}}}
\makeatother

% \tensor and \multiscript
\makeatletter
\newif\if@sup
\newtoks\@sups
\def\append@sup#1{\edef\act{\noexpand\@sups={\the\@sups #1}}\act}%
\def\reset@sup{\@supfalse\@sups={}}%
\def\mk@scripts#1#2{\if #2/ \if@sup ^{\the\@sups}\fi \else%
  \ifx #1_ \if@sup ^{\the\@sups}\reset@sup \fi {}_{#2}%
  \else \append@sup#2 \@suptrue \fi%
  \expandafter\mk@scripts\fi}
\def\tensor#1#2{\reset@sup#1\mk@scripts#2_/}
\def\multiscripts#1#2#3{\reset@sup{}\mk@scripts#1_/#2%
  \reset@sup\mk@scripts#3_/}
\makeatother

% \slash
\makeatletter
\newbox\slashbox \setbox\slashbox=\hbox{$/$}
\def\itex@pslash#1{\setbox\@tempboxa=\hbox{$#1$}
  \@tempdima=0.5\wd\slashbox \advance\@tempdima 0.5\wd\@tempboxa
  \copy\slashbox \kern-\@tempdima \box\@tempboxa}
\def\slash{\protect\itex@pslash}
\makeatother

% math-mode versions of \rlap, etc
% from Alexander Perlis, "A complement to \smash, \llap, and lap"
%   http://math.arizona.edu/~aprl/publications/mathclap/
\def\clap#1{\hbox to 0pt{\hss#1\hss}}
\def\mathllap{\mathpalette\mathllapinternal}
\def\mathrlap{\mathpalette\mathrlapinternal}
\def\mathclap{\mathpalette\mathclapinternal}
\def\mathllapinternal#1#2{\llap{$\mathsurround=0pt#1{#2}$}}
\def\mathrlapinternal#1#2{\rlap{$\mathsurround=0pt#1{#2}$}}
\def\mathclapinternal#1#2{\clap{$\mathsurround=0pt#1{#2}$}}

% Renames \sqrt as \oldsqrt and redefine root to result in \sqrt[#1]{#2}
\let\oldroot\root
\def\root#1#2{\oldroot #1 \of{#2}}
\renewcommand{\sqrt}[2][]{\oldroot #1 \of{#2}}

% Manually declare the txfonts symbolsC font
\DeclareSymbolFont{symbolsC}{U}{txsyc}{m}{n}
\SetSymbolFont{symbolsC}{bold}{U}{txsyc}{bx}{n}
\DeclareFontSubstitution{U}{txsyc}{m}{n}

% Manually declare the stmaryrd font
\DeclareSymbolFont{stmry}{U}{stmry}{m}{n}
\SetSymbolFont{stmry}{bold}{U}{stmry}{b}{n}

% Manually declare the MnSymbolE font
\DeclareFontFamily{OMX}{MnSymbolE}{}
\DeclareSymbolFont{mnomx}{OMX}{MnSymbolE}{m}{n}
\SetSymbolFont{mnomx}{bold}{OMX}{MnSymbolE}{b}{n}
\DeclareFontShape{OMX}{MnSymbolE}{m}{n}{
    <-6>  MnSymbolE5
   <6-7>  MnSymbolE6
   <7-8>  MnSymbolE7
   <8-9>  MnSymbolE8
   <9-10> MnSymbolE9
  <10-12> MnSymbolE10
  <12->   MnSymbolE12}{}

% Declare specific arrows from txfonts without loading the full package
\makeatletter
\def\re@DeclareMathSymbol#1#2#3#4{%
    \let#1=\undefined
    \DeclareMathSymbol{#1}{#2}{#3}{#4}}
\re@DeclareMathSymbol{\neArrow}{\mathrel}{symbolsC}{116}
\re@DeclareMathSymbol{\neArr}{\mathrel}{symbolsC}{116}
\re@DeclareMathSymbol{\seArrow}{\mathrel}{symbolsC}{117}
\re@DeclareMathSymbol{\seArr}{\mathrel}{symbolsC}{117}
\re@DeclareMathSymbol{\nwArrow}{\mathrel}{symbolsC}{118}
\re@DeclareMathSymbol{\nwArr}{\mathrel}{symbolsC}{118}
\re@DeclareMathSymbol{\swArrow}{\mathrel}{symbolsC}{119}
\re@DeclareMathSymbol{\swArr}{\mathrel}{symbolsC}{119}
\re@DeclareMathSymbol{\nequiv}{\mathrel}{symbolsC}{46}
\re@DeclareMathSymbol{\Perp}{\mathrel}{symbolsC}{121}
\re@DeclareMathSymbol{\Vbar}{\mathrel}{symbolsC}{121}
\re@DeclareMathSymbol{\sslash}{\mathrel}{stmry}{12}
\re@DeclareMathSymbol{\bigsqcap}{\mathop}{stmry}{"64}
\re@DeclareMathSymbol{\biginterleave}{\mathop}{stmry}{"6}
\re@DeclareMathSymbol{\invamp}{\mathrel}{symbolsC}{77}
\re@DeclareMathSymbol{\parr}{\mathrel}{symbolsC}{77}
\makeatother

% \llangle, \rrangle, \lmoustache and \rmoustache from MnSymbolE
\makeatletter
\def\Decl@Mn@Delim#1#2#3#4{%
  \if\relax\noexpand#1%
    \let#1\undefined
  \fi
  \DeclareMathDelimiter{#1}{#2}{#3}{#4}{#3}{#4}}
\def\Decl@Mn@Open#1#2#3{\Decl@Mn@Delim{#1}{\mathopen}{#2}{#3}}
\def\Decl@Mn@Close#1#2#3{\Decl@Mn@Delim{#1}{\mathclose}{#2}{#3}}
\Decl@Mn@Open{\llangle}{mnomx}{'164}
\Decl@Mn@Close{\rrangle}{mnomx}{'171}
\Decl@Mn@Open{\lmoustache}{mnomx}{'245}
\Decl@Mn@Close{\rmoustache}{mnomx}{'244}
\Decl@Mn@Open{\llbracket}{stmry}{'112}
\Decl@Mn@Close{\rrbracket}{stmry}{'113}
\makeatother

% Widecheck
\makeatletter
\DeclareRobustCommand\widecheck[1]{{\mathpalette\@widecheck{#1}}}
\def\@widecheck#1#2{%
    \setbox\z@\hbox{\m@th$#1#2$}%
    \setbox\tw@\hbox{\m@th$#1%
       \widehat{%
          \vrule\@width\z@\@height\ht\z@
          \vrule\@height\z@\@width\wd\z@}$}%
    \dp\tw@-\ht\z@
    \@tempdima\ht\z@ \advance\@tempdima2\ht\tw@ \divide\@tempdima\thr@@
    \setbox\tw@\hbox{%
       \raise\@tempdima\hbox{\scalebox{1}[-1]{\lower\@tempdima\box
\tw@}}}%
    {\ooalign{\box\tw@ \cr \box\z@}}}
\makeatother

% \mathraisebox{voffset}[height][depth]{something}
\makeatletter
\NewDocumentCommand\mathraisebox{moom}{%
\IfNoValueTF{#2}{\def\@temp##1##2{\raisebox{#1}{$\m@th##1##2$}}}{%
\IfNoValueTF{#3}{\def\@temp##1##2{\raisebox{#1}[#2]{$\m@th##1##2$}}%
}{\def\@temp##1##2{\raisebox{#1}[#2][#3]{$\m@th##1##2$}}}}%
\mathpalette\@temp{#4}}
\makeatletter

% udots (taken from yhmath)
\makeatletter
\def\udots{\mathinner{\mkern2mu\raise\p@\hbox{.}
\mkern2mu\raise4\p@\hbox{.}\mkern1mu
\raise7\p@\vbox{\kern7\p@\hbox{.}}\mkern1mu}}
\makeatother

%% Fix array
\newcommand{\itexarray}[1]{\begin{matrix}#1\end{matrix}}
%% \itexnum is a noop
\newcommand{\itexnum}[1]{#1}

%% Renaming existing commands
\newcommand{\underoverset}[3]{\underset{#1}{\overset{#2}{#3}}}
\newcommand{\widevec}{\overrightarrow}
\newcommand{\darr}{\downarrow}
\newcommand{\nearr}{\nearrow}
\newcommand{\nwarr}{\nwarrow}
\newcommand{\searr}{\searrow}
\newcommand{\swarr}{\swarrow}
\newcommand{\curvearrowbotright}{\curvearrowright}
\newcommand{\uparr}{\uparrow}
\newcommand{\downuparrow}{\updownarrow}
\newcommand{\duparr}{\updownarrow}
\newcommand{\updarr}{\updownarrow}
\newcommand{\gt}{>}
\newcommand{\lt}{<}
\newcommand{\map}{\mapsto}
\newcommand{\embedsin}{\hookrightarrow}
\newcommand{\Alpha}{A}
\newcommand{\Beta}{B}
\newcommand{\Zeta}{Z}
\newcommand{\Eta}{H}
\newcommand{\Iota}{I}
\newcommand{\Kappa}{K}
\newcommand{\Mu}{M}
\newcommand{\Nu}{N}
\newcommand{\Rho}{P}
\newcommand{\Tau}{T}
\newcommand{\Upsi}{\Upsilon}
\newcommand{\omicron}{o}
\newcommand{\lang}{\langle}
\newcommand{\rang}{\rangle}
\newcommand{\Union}{\bigcup}
\newcommand{\Intersection}{\bigcap}
\newcommand{\Oplus}{\bigoplus}
\newcommand{\Otimes}{\bigotimes}
\newcommand{\Wedge}{\bigwedge}
\newcommand{\Vee}{\bigvee}
\newcommand{\coproduct}{\coprod}
\newcommand{\product}{\prod}
\newcommand{\closure}{\overline}
\newcommand{\integral}{\int}
\newcommand{\doubleintegral}{\iint}
\newcommand{\tripleintegral}{\iiint}
\newcommand{\quadrupleintegral}{\iiiint}
\newcommand{\conint}{\oint}
\newcommand{\contourintegral}{\oint}
\newcommand{\infinity}{\infty}
\newcommand{\bottom}{\bot}
\newcommand{\minusb}{\boxminus}
\newcommand{\plusb}{\boxplus}
\newcommand{\timesb}{\boxtimes}
\newcommand{\intersection}{\cap}
\newcommand{\union}{\cup}
\newcommand{\Del}{\nabla}
\newcommand{\odash}{\circleddash}
\newcommand{\negspace}{\!}
\newcommand{\widebar}{\overline}
\newcommand{\textsize}{\normalsize}
\renewcommand{\scriptsize}{\scriptstyle}
\newcommand{\scriptscriptsize}{\scriptscriptstyle}
\newcommand{\mathfr}{\mathfrak}
\newcommand{\statusline}[2]{#2}
\newcommand{\tooltip}[2]{#2}
\newcommand{\toggle}[2]{#2}

% Theorem Environments
\theoremstyle{plain}
\newtheorem{theorem}{Theorem}
\newtheorem{lemma}{Lemma}
\newtheorem{prop}{Proposition}
\newtheorem{cor}{Corollary}
\newtheorem*{utheorem}{Theorem}
\newtheorem*{ulemma}{Lemma}
\newtheorem*{uprop}{Proposition}
\newtheorem*{ucor}{Corollary}
\theoremstyle{definition}
\newtheorem{defn}{Definition}
\newtheorem{example}{Example}
\newtheorem*{udefn}{Definition}
\newtheorem*{uexample}{Example}
\theoremstyle{remark}
\newtheorem{remark}{Remark}
\newtheorem{note}{Note}
\newtheorem*{uremark}{Remark}
\newtheorem*{unote}{Note}

%-------------------------------------------------------------------

\begin{document}

%-------------------------------------------------------------------

\section*{Linear Temporal Logic and Queueing}

This page discusses the paper by \href{http://sites.bu.edu/hyness/files/2016/02/coogan2015trafficltl.pdf}{Coogan, et al} and also has some theoretical background for different queueing disciplines.

\hypertarget{queueing_disciplines}{}\subsubsection*{{Queueing Disciplines}}\label{queueing_disciplines}

There are many different disciplines for queueing. The FIFO (first-in-first-out) is the general standard. We also have several others worth discussing, and mathematical ways to represent them.

The notation described below is from \href{https://dl.acm.org/doi/10.1145/322003.322009}{Chandy, et al}. The queueing disciplines I'll list here are FIFO, LCFSPR (last-come-first-served preemptive resume), PS (processor sharing), IS (infinite server), preemptive fixed priority, and nonpreemptive fixed priority.

In particular, we will focus on expressing the queueing disciplines with two families of parameters: the arrival probabilities and the service rates.

\emph{Customer classes: There are $K$ different classes of customers who use the queue, numbered $k = 1,2,\ldots K$. Each class has an arrival rate $\lambda_{k}$ according to a Poisson process, and a service distribution $F_{k}$, which is general, though usually taken to be exponential.}

\emph{States: Chandy et al view the queue as a set of stations, each of which is occupied by one customer. If there are $n$ customers in the queue, then the occupied stations are indexed by $i=1,2,\ldots n$. $k(i)$ is the class of the customer at station $i$. The \textbf{state} of the queue is given by $S = (k(1),\ldots,k(n))$and gives the occupancy of the queue. An example state is}

\begin{displaymath}
S = (3,2,1,1,2,2)
\end{displaymath}
which shows that we have 6 customers in queue, the first of which is class 3, the second of class 2, etc.

\emph{Remark: The complete state of the queue needs to also account for the remaining service requirement of station $i$, but we don't need that stuff right now.}

\begin{itemize}%
\item Queueing discipline: Here is where we describe the queueing disciplines. They are described using the conditional arrival probabilities $a(i|S,k)$ which describes the probability an arriving customer will enter station $i$, given the current state $S$ and the customer's class $k$; and the service rates $r(i|S)$, which describes the service rate for the customer at station $i$, given the occupancy state $S$. The \textbf{gross service rate} $R(S) = \sum_{i=1}^{n}r(i|S)$, and is typically 1.

\end{itemize}
We now characterize the above service disciplines and explain:

\begin{enumerate}%
\item FCFS: First-Come-First-Serve. We have that

\begin{displaymath}
a(i|S,k) = \delta_{i,n+1}
\end{displaymath}
where $\delta_{i,n+1} = 1$ if $i=n+1$, and 0 otherwise. This means that an arriving customer goes to the back of the line with probability 1 and nowhere else, regardless of class.

\begin{displaymath}
r(i|S) = \delta_{i,1}
\end{displaymath}
Here this means that the server is serving only the first customer in line.

\item LCFSPR: Last-Come-First-Serve-Preemptive-Resume

\begin{displaymath}
a(i|S,k) = \delta_{i,1}
\end{displaymath}
This time, the arriving customer is put at the top of the stack as soon as it arrives, regardless of class, and nowhere else.

\begin{displaymath}
r(i|S) = \delta_{i,1}
\end{displaymath}
As with FCFS, the first customer in the queue is served, and only this one.

\item PS: Processor Sharing

\begin{displaymath}
a(i|S,k) = \frac{1}{n+1}
\end{displaymath}
Here, the arriving customer (which makes a total of $n+1$ customers) can go anywhere in slots $i=1,\ldots n+1$ with equal probaility.

\begin{displaymath}
r(i|S) = \frac{1}{n}
\end{displaymath}
Here, the server is shared equally among all current customers. The rate each customer gets is the $1/n$ fraction of the rate a lone customer would get.

\item IS: Infinite Server

\begin{displaymath}
a(i|S,k) = \frac{1}{n+1}
\end{displaymath}
Same as PS.

\begin{displaymath}
r(i|S) = 1
\end{displaymath}
Here, we assume that the server has the capacity to give its full attention to every single customer in the queue at the same time. Basically ``perfect multitasking''. This is mostly a theoretical limit and not used in practice often.

\item PFP: Preemptive Fixed Priority

\begin{displaymath}
a(i|S,k) = \delta_{i,1+\sum_{j=1}^{k}n_{j}}
\end{displaymath}
Here we'll have to expand. With fixed priority queueing disciplines, we have that all customers of class 1 come before all customers of class 2, etc. So an arriving customer goes to the back of the line for its class. $n_{j}$ denotes the number of customers of class $j$ in the state $S$. For example, if $S = (1,1,2,3,3)$, and an arriving customer is of class 2, $a(i|S,k)$ is only 1 for $i = 1+(2+1) = 4$, which puts it in the 4th position behind the current class 2 customer. Preemptive fixed priority states that a customer of class 1 can push down a current customer of a lower class, so if $S = (2,2,3)$, and a customer of class 1 arrives, it will go to the head of the line and pre-empt the current customer who is class 2.

\begin{displaymath}
r(i|s) = \delta_{i,1}
\end{displaymath}
The server concentrates all its attention on the first customer in line.

\item NFP: Non-preemptive Fixed Priority This discipline is similar, but doesn't ``push down'' a customer of a lower class.

\begin{displaymath}
a(i|S,k) = \delta_{i, 2+\sum_{j=1}^{k}n_{j}}
\end{displaymath}
This shows us that if we have $S = (2,2,3)$, and a customer of class 1 arrives, it will go in position $2 + (0) = 2$, which is right behind the current class 2 customer, so the current head of the line isn't pushed away.

\begin{displaymath}
r(i|S) = \delta_{i,1}
\end{displaymath}

\end{enumerate}
\hypertarget{more_on_states}{}\subsubsection*{{More on States}}\label{more_on_states}

This section details a bit more about the states of the queue.

\hypertarget{feasibility}{}\paragraph*{{Feasibility}}\label{feasibility}

We call a state $S = (k(1),\ldots,k(n))$ \textbf{feasible} if

\begin{itemize}%
\item $S = \emptyset$, which corresponds to an empty queue, or
\item $S = S' + (i,k)$, where we obtain a new state from a feasible state by inserting a customer of class $k$ in station $i$, such that the arrival probability $a(i|S',k) \neq 0$, and is thus governed by the queueing discipline. For $S' = (k'(1),k'(2),\ldots, k'(n))$,\begin{displaymath}
S = S' + (i,k) = (k'(1),k'(2),\ldots,k'(i-1),k,k'(i+1),\ldots,k'(n))
\end{displaymath}
where we insert the new customer into slot $i$, pushing the customer formerly in slot $i$ to slot $i+1$, and so forth. The new length of the state is $n+1$. For example, for $S' = (2,3,3,1)$ that is presumed feasible, and an arrival customer $(2,1)$, then

\begin{displaymath}
S = S' + (2,1) = (2,3,3,1) + (2,1) = (2,1,3,3,1)
\end{displaymath}
where the arriving customer of class one is inserted into station 2, and is of class 1.

\item $S = S'-i$, where we remove the customer at station $i$ from a feasible state $S'$, where $r(i|S') \gt 0$. This is also governed by the queueing discipline.

\end{itemize}
We'll look at creating the set of feasible states with a few examples of queueing disciplines from before.

\begin{enumerate}%
\item FCFS: For FCFS, $a(i|S,k) = \delta_{i,n+1}$. The first feasible state is $\emptyset$. From there, we build $S = (k(1))$, which is a single customer in the queue with class $k(1)$. Following this, we can only add customers to the back of the line, regardless of the customer class. Thus, we can only get additional states of the form $S' + (i,k)$ where $i = n+1$. Via the subtraction/removal method, $r(i|S) = \delta_{i,1}$, and thus we can only remove customers from the first slot. Thus $S-1$ are the only feasible ``subtraction'' states.

\item PS: For Processor sharing, $a(i|S,k) = \frac{1}{n+1}$, meaning we are allowed to insert any customer of any class into any station $i \in \{1,2,\ldots, n+1\}$, and it's done with equal probability. $r(i|S) = \frac{1}{n}$, so removal from any station $i=1,\ldots,n$ is feasible if there is a customer in that position to remove. Then from $\emptyset$, we can build $S = (k(1))$. From there, we may insert the next customer either in front of the first, or behind, or we may remove that customer. Similarly, for $S = (k(1),\ldots,k(n))$, any $S + (i,k)$ is feasible for $i=1,\ldots n+1$, and any $S-i$ is feasible for $i=1,\ldots,n$.

\item PFP: Pre-emptive fixed priority has $a(i|S,k) = \delta_{i,1+\sum_{j=1}^{k}n_{j}}$, and $r(i|S) = \delta_{i,1}$. Then the set of feasible states gets a little more complicated. From $\emptyset$, we can build $S = (k(1))$. After that, what is feasible depends on $k(1)$. If the next arrival is a higher class, we must insert it ahead of the original customer. If the next arrival is the same class or lower, we must insert it behind the original. And like FCFS, we can only remove a customer from the head of the line, so only $S-1$ is feasible for feasible states $S$.

\end{enumerate}
We assign a probability of 0 to infeasible states and disregard them.

\hypertarget{complete_state_with_service_requirement}{}\paragraph*{{Complete State (with Service Requirement)}}\label{complete_state_with_service_requirement}

Regardless of situation, every customer comes with a service requirement that is random (sometimes called a service distribution). In the simplest case, the service requirement is given an exponential distribution for all customers, perhaps varying the rate with the class of customer. The exponential distribution is the most common one employed, because the distribution is memoryless, and we don't need to keep track of the residual work remaining while a customer is in service.

However, there are many cases where we want to allow something besides the exponential distribution as a service requirement. Since the exponential distribution is the only continuous distribution with the memoryless property, changing the service requirement to anything else will require us to keep track of the residual work for each customer. There are many different ways to handle this, and this can be a topic of discussion if necessary.

Where this is relevant to the state of the queue is to note that the state $S$ above only gives the discrete part, or occupancy, of the queue. We also need to tack on another vector that tracks each customer's remaining service requirement. The \textbf{complete state} $X = (S, X_{1},\ldots,X_{n})$ takes the occupancy $S$ and appends $X_{i}$, a variable giving the remaining service requirement. The service requirement is presume identical for each class of customers and is denoted $F_{k}$, $k=1,\ldots,K$. When a new customer of class $k$ is inserted at station $i$, then $X_{i}$ is chosen according to the distribution $F_{k}$. As a customer is served, his residual service requirement decreases continuously to 0, at which point the customer departs. $X_{i}$ decreases according to the rate $r(i|S)$ determined by the service discipline, so $\frac{d X_{i}}{dt} = -r(i|S)$.

\end{document}


\documentclass[doublespace]{rackham-thesis}
% doublespace - double space document
% proposal - make proposal title page

\usepackage[linktocpage=true]{hyperref}
\usepackage[style=authoryear-comp,backend=biber]{biblatex}
\usepackage[utf8]{inputenc}
\usepackage{amsmath, amssymb, amsthm, xfrac}
\usepackage{booktabs}
\usepackage{lipsum}
\usepackage{flafter} % prevents floats before section titles

\bibliography{references}

\begin{document}

\title{Writing a Rackham Thesis: Theories and practice}
\author{Donald Knuth}
\degree{Doctor of Philosophy}
\department{Electrical Engineering}
\committee{
  Professor Edsger Dijkstra, Chair \\
  Professor Alan Turing \\
  Professor Stephen Cook
}

\maketitle
\frontispiece{
  If you optimize everything, you will always be unhappy.\\[2\baselineskip]
	---Donald Knuth
}  % optional
% specifying copyright is optional
\identifierpage[copyright]{dknuth@umich.edu}{9999-9999-9999-9999}
\dedication{To Jill}  % optional
\acknowledgments % optional
Everything here is part of the acknowledgments.
\lipsum[1]

\preface % optional
Everything here is part of the preface.
\lipsum[1]

\tableofcontents  % mandatory
\listoffigures  % mandatory if more than one figure
\listoftables  % mandatory if more than one table
\listofappendices  % mandatory if more than one appendix
% List of Abbreviations, List of Acronyms, List of Symbols: Optional; must have page number
\abstract  % mandatory
This is the abstract.
\lipsum[1]

\chapter{Algorithms}

Shortest paths are wicked cool \parencite{dijkstra}.
Table~\ref{tab:alg} shows how cool some algorithms are.

\begin{table}[h]
    \centering
    \caption{Cool Algorithms}
    \begin{tabular}{ll} \toprule
        Algorithm & Coolness \\ \midrule
        Shortest Path & Wicked \\
        Support Vector Machine & Sick \\
        Fast Fourier Transform & Disgusting \\ \bottomrule
    \end{tabular}
    \label{tab:alg}
\end{table}

Figure~\ref{fig:alg} is a more easily digestible representation of the same data.

\begin{figure}[h]
    \centering
    \begin{tabular}{r|ccc}
        Sick & & x \\
        Disgusting & & & x \\
        Wicked & x \\ \hline
        & Shortest & SVM & FFT \\
        & Path \\
    \end{tabular}
    \caption{Cool Algorithms}
    \label{fig:alg}
\end{figure}

\chapter{Turing Machines}

On the other hand---according to \textcite{turing}---Turing machines are also cool.
See Figure~\ref{fig:comp} for a contradiction.
\lipsum[4]

\begin{figure}
    \centering
    {
        \Huge
        \begin{equation*}
            \lambda x . x
        \end{equation*}
    }
    \caption{Downside of Turing machines}
    \label{fig:comp}
\end{figure}

\section{Reductions}

But what cool reductions \parencite{cook}!
Table~\ref{tab:red} has the answer.
\lipsum[5-7]

\begin{table}
    \centering
    \caption{The Answer}
    \begin{tabular}{c} \toprule
        Cool Reductions \\ \midrule
        3-SAT \\
        Gadgets \\ \bottomrule
    \end{tabular}
    \label{tab:red}
\end{table}

\appendix

\chapter{Lorem}
\lipsum[8-13]

\chapter{Ipsum}
\lipsum[14]

\printbibliography

\end{document}


\subsection{Regular expressions}
\begin{compactenum}
\item POSIX character classes:
\begin{compactenum}
\item \texttt{[:lower:]} $=$ \texttt{[a-z]}
\item \texttt{[:alpha:]} $=$ \texttt{[a-zA-Z]}
\item \texttt{[:alnum:]} $=$ \texttt{[a-zA-Z0-9]}
\item \texttt{[:word:]} $=$ \texttt{[A-Za-z0-9\_]}
\item \texttt{[:digit:]} $=$ \texttt{[0-9]}
\item \texttt{[:xdigit:]} $=$ \texttt{[A-Fa-f0-9]}
\item \texttt{[:blank:]} $=$ \texttt{[ \textbackslash{}t]}
\item \texttt{[:space:]} $=$ \texttt{[ \textbackslash{}t\textbackslash{}r\textbackslash{}n\textbackslash{}v\textbackslash{}f]}
\item \texttt{[:cntrl:]} $=$ \texttt{[\textbackslash{}x00-\textbackslash{}x1F\textbackslash{}x7F]}
\item \texttt{[:graph:]} $=$ \texttt{[\textbackslash{}x21-\textbackslash{}x7E]}
\item \texttt{[:print:]} $=$ \texttt{[\textbackslash{}x20-\textbackslash{}x7E]}
\item \texttt{[:ascii:]} $=$ \texttt{[\textbackslash{}x00-\textbackslash{}x7F]}
\end{compactenum}
\item Repetitions:
\begin{compactenum}
\item \texttt{*}: $0$ or more, \texttt{+}: $1$ or more, \texttt{?}: $0$ or $1$,
\item \texttt{\{a, b\}}: at least $a$, at most $b$.
\end{compactenum}
\item Anchors:
\begin{compactenum}
\item \texttt{\textasciicircum}: start of line,
\item \texttt{\$}: end of line,
\item \texttt{\textbackslash{}<}: start of word,
\item \texttt{\textbackslash{}>}: end of word.
\end{compactenum}
\item Other:
\begin{compactenum}
\item \texttt{one|two}: one or two,
\item \texttt{(one)}: a group,
\item \texttt{\$n}: $n$th group,
\item \texttt{[abcd]}, \texttt{[a-d]}: ranges,
\item \texttt{[\textasciicircum{}abcd]}: negation (not \texttt{[abcd]}).
\end{compactenum}
\end{compactenum}


\documentclass[acmtog]{acmart}
\usepackage{graphicx}
\usepackage{subfigure}
\usepackage{natbib}
\usepackage{listings}
\usepackage{bm}

\definecolor{blve}{rgb}{0.3372549 , 0.61176471, 0.83921569}
\definecolor{gr33n}{rgb}{0.29019608, 0.7372549, 0.64705882}
\makeatletter
\lst@InstallKeywords k{class}{classstyle}\slshape{classstyle}{}ld
\makeatother
\lstset{language=C++,
	basicstyle=\ttfamily,
	keywordstyle=\color{blve}\ttfamily,
	stringstyle=\color{red}\ttfamily,
	commentstyle=\color{magenta}\ttfamily,
	morecomment=[l][\color{magenta}]{\#},
	classstyle = \bfseries\color{gr33n},
	tabsize=2,
	breaklines=true
}
\lstset{basicstyle=\ttfamily}

% Title portion
\title{Assignment 5:\\ {Rigid Body Simulation}}

\author{Name:\quad Yang Hongdi  \\ student number:\ 2019533234
\\email:\quad yanghd@shanghaitech.edu.cn}

% Document starts
\begin{document}
\maketitle

\vspace*{2 ex}

\section{Introduction}
In this assignment, simple rigid body simulation is performed without considering rotation. The intersection
between spheres and walls and intersection between spheres is performed.
\section{Implementation Details}
\subsection{Make the Scene Move}
To make the scene move, we update the spheres' P(linear momentum), speed and position every dt. As $$P = F * t = M * v$$
we update sphere's state by function below.
\begin{lstlisting}
void Sphere::Forward(float dt)
{
    for (Force const_force : constant_forces)
    {
        this->P += const_force.F * dt;
    }
    for (Force trans_force : transient_forces)
    {
        this->P += trans_force.F * dt;
    }
    this->v = this->P / this->M;
    this->x += this->v * dt;
    UpdateOpenGLObject();
}
\end{lstlisting}
\subsection{Collision Detect}
\subsubsection{SphereParallelgoram Collision Detection}
\quad For collision detection between sphere and parallelgoram, we first check the distance between sphere and the plane the parallelgoram is on.
\begin{lstlisting}
	vec3 normal = glm::normalize(glm::cross(parlgrm_s1, parlgrm_s2));
    vec3 temp_line = parlgrm_x - sphere_x;
    float dist = abs(glm::dot(normal, temp_line));

    if (dist - sphere_r > 0) // not intersect
    {
        collision_info.is_collided = false;
        return false;
    }
\end{lstlisting}
Then we will check if the intersect circle is in the parallelgoram. We first check if the collision point is in the parallelgoram, and then we will check
if the circle intersect with each edge of the parallelgoram.
\subsubsection{SphereSphere Collision Detection}
\quad For collision detection between spheres, we simply compute the distance between the center of spheres. If the distance is smaller than the sum of two spheres' radius, then
the two spheres are collided.
\subsection{Adjust Collision}
As we are updating the spheres' state discontinuously, it is possible that the sphere would collide with wall at a deep point in the wall, so the sphere may not be able to get out
next dt and then it will go into the wall. To prevent this, we need to adjust the collision.\\
To adjust the collision, we need to find a time between t and $t + \Delta t$ where the intersection degree is in the intersection tolerance.
\begin{figure}[H]
	\centering
	\includegraphics[width=3.2in, height = 2in]{images/interpenetration.png}
	\caption{find tc in tolerance}
\end{figure}
so we find the suitable time $t_c$ recursively between t and $t + \Delta t$.
\begin{lstlisting}
void Scene::FindRealCollision(float& intersect_degree, float delta_t)
{
    if (!IsCollided(intersect_degree))
    {
        this->Forward(delta_t / 2);
        return FindRealCollision(intersect_degree, delta_t / 2);
    }
    else if (intersect_degree - intersect_tolerance > 1e-4)
    {
        this->Backward(delta_t);
        this->Forward(delta_t / 2);
        return FindRealCollision(intersect_degree, delta_t / 2);
    }
}
\end{lstlisting}
\subsection{Handle Colliding contact}
\subsubsection{Handle collision between sphere and wall}
\quad When handling collison between sphere and wall, as wall is static, we consider its Mass as infinity and zero speed.\\
Then we compute the sphere's speed along the normal direction of the wall.
\begin{lstlisting}
	vec3 sphere_speed = sphere.GetV();
	vec3 normal = glm::normalize(sphere.GetX() - temp_collision_info.collision_point);
	float vrel = glm::dot(sphere_speed, normal);// relative speed on normal direction
	vec3 v_normal = vrel * normal;
\end{lstlisting}
If $v_{rel} > threshold$, we consider the ball is leaving the wall, thus not collided.\\
If $v_{rel} > -threshold$, we consider the ball has resting contact with the wall, and we will apply support force on the sphere.
\begin{lstlisting}
	Force sphere_press_force;
	for (Force force : sphere.constant_forces) sphere_press_force.F += force.F;
	for (Force force : sphere.transient_forces) sphere_press_force.F += force.F;
	sphere_press_force.F = glm::dot(sphere_press_force.F, normal) * normal;
	Force N;
	N.F = -sphere_press_force.F; // support force
\end{lstlisting}
And if neither of above, we do the real collision handling.\\
We consider the collision make the sphere's relative speed $v_{rel}$ become $-0.8 * v_{rel}$ in dt time, so we compute F by
$$F = \frac{M\cdot-(1+0.8)\cdot v_{rel}}{dt}$$
During collision, we also consider the speed will decrease 0.01 along the tangent direction, so we also add a Force $F = \frac{M\cdot-(1 - 0.99)\cdot v_{tan}}{dt}$
to the sphere.
\subsubsection{Handle collision between spheres}
\quad For the collision between spheres, we also first compute the relative speed along the intersection direction.
The relative speed is considered as $v_1 - v_2$
\begin{lstlisting}
	vec3 sphere1_speed = sphere1.GetV();
	vec3 sphere2_speed = sphere2.GetV();
	vec3 collision_normal = glm::normalize(sphere1.GetX() - sphere2.GetX());
	float vrel = glm::dot(sphere1_speed - sphere2_speed, collision_normal);
	vec3 v_normal = vrel * collision_normal;
\end{lstlisting}
Then, same as above, we check if the sphere is leaving each other or having resting contact.\\
If the spheres are having real collision, we consider the collision make the relative speed $v_{rel}$ become $-0.8 * v_{rel}$, and we compute the
total collision force F.
$$F = \frac{-(1+0.8)\cdot v_{rel}}{(\frac{1}{M_1} + \frac{1}{M_2})\cdot dt}$$
And for each ball, we add $\frac{F}{2}$ on it.\\
\\ The transient forces will be cleared immediately after updating the sphere for next dt.
\section{Results}
The results will be showed in real-time to TAs.
\newpage
\begin{figure}[H]
		\centering

		\subfigure[Scene0]{
		\begin{minipage}[t]{0.45\linewidth}
		\centering
		\includegraphics[width=2.5in]{images/scene0.png}
		%\caption{original image}
		\end{minipage}%
		}

		\subfigure[Scene1]{
		\begin{minipage}[t]{0.45\linewidth}
		\centering
		\includegraphics[width=2.5in]{images/scene1.png}
		%\caption{original image}
		\end{minipage}%
		}

		\subfigure[Scene2]{
		\begin{minipage}[t]{0.45\linewidth}
		\centering
		\includegraphics[width=2.5in]{images/scene2.png}
		%\caption{original image}
		\end{minipage}%
		}

		\subfigure[Scene3]{
		\begin{minipage}[t]{0.45\linewidth}
		\centering
		\includegraphics[width=2.5in]{images/scene3.png}
		%\caption{original image}
		\end{minipage}%
		}
	\end{figure}
	\begin{figure}[H]
		\centering
		\subfigure[Scene4]{
			\begin{minipage}[t]{0.45\linewidth}
			\centering
			\includegraphics[width=2.5in]{images/scene4.png}
			%\caption{original image}
			\end{minipage}%
			}
	\end{figure}
\end{document}


%%%%%%%% ICML 2018 EXAMPLE LATEX SUBMISSION FILE %%%%%%%%%%%%%%%%%

\documentclass{article}

% Recommended, but optional, packages for figures and better typesetting:
\usepackage{microtype}
\usepackage{graphicx}
\usepackage{subfigure}
\usepackage{booktabs} % for professional tables

% my packages
\usepackage{amsmath}
\usepackage{amssymb}

% hyperref makes hyperlinks in the resulting PDF.
% If your build breaks (sometimes temporarily if a hyperlink spans a page)
% please comment out the following usepackage line and replace
% \usepackage{icml2018} with \usepackage[nohyperref]{icml2018} above.
\usepackage{hyperref}

% Attempt to make hyperref and algorithmic work together better:
\newcommand{\theHalgorithm}{\arabic{algorithm}}

% Use the following line for the initial blind version submitted for review:
\usepackage{icml2018}

% If accepted, instead use the following line for the camera-ready submission:
%\usepackage[accepted]{icml2018}

% The \icmltitle you define below is probably too long as a header.
% Therefore, a short form for the running title is supplied here:
\icmltitlerunning{Fully Autonomous First Order Mathematical Optimizer}

\begin{document}

\twocolumn[
\icmltitle{Fully Autonomous First Order Mathematical Optimizer}

% It is OKAY to include author information, even for blind
% submissions: the style file will automatically remove it for you
% unless you've provided the [accepted] option to the icml2018
% package.

% List of affiliations: The first argument should be a (short)
% identifier you will use later to specify author affiliations
% Academic affiliations should list Department, University, City, Region, Country
% Industry affiliations should list Company, City, Region, Country

% You can specify symbols, otherwise they are numbered in order.
% Ideally, you should not use this facility. Affiliations will be numbered
% in order of appearance and this is the preferred way.
%\icmlsetsymbol{equal}{*}

\begin{icmlauthorlist}
\icmlauthor{Animesh Karnewar}{ir}
\end{icmlauthorlist}

\icmlaffiliation{ir}{Independent Researcher}

\icmlcorrespondingauthor{Animesh Karnewar}{animeshsk3@gmail.com}

% You may provide any keywords that you
% find helpful for describing your paper; these are used to populate
% the "keywords" metadata in the PDF but will not be shown in the document
\icmlkeywords{Mathematical Optimization, First order optimization}

\vskip 0.3in
]

% this must go after the closing bracket ] following \twocolumn[ ...

% This command actually creates the footnote in the first column
% listing the affiliations and the copyright notice.
% The command takes one argument, which is text to display at the start of the footnote.
% The \icmlEqualContribution command is standard text for equal contribution.
% Remove it (just {}) if you do not need this facility.

%\printAffiliationsAndNotice{}  % leave blank if no need to mention equal contribution
\printAffiliationsAndNotice{} % otherwise use the standard text.

\begin{abstract}
This research paper describes a technique for performing mathematical optimization, which is free from any hyperparameters. The optimization requires only first order derivatives of the objective function with respect to the learning parameters. The step size, more commonly known as the learning rate, which is manually set for training is replaced by a heuristic which calculates an optimal step size relative to the instantaneous value of the objective function. Finally the results obtained on the MNIST dataset by using this technique are presented and discussed in brief while comparing to other optimization algorithms. The algorithm proves its stability on the MNIST classification and achieves performance comparable to Adam optimizer which is the current standard.
\end{abstract}

\section{Introduction}
\textbf{Mathematical Optimization} lies at the heart of Machine Learning. In order to statistically fit the function over the given data, the learnable parameters of the model are modified according to a certain objective function. This is true for both supervised and unsupervised learning. In case of the latter, the distinction is based only in the definition of the objective function, which in this case doesn’t involve any label information. The optimization is performed on a mathematical function \textit{f(x)} known as the \textbf{objective function} or \textbf{criterion} by obtaining the value of \textit{x} such that the value of \textit{f(x)} is optimal (either maximum or minimum). In general context, optimization refers to minimization of the criterion. The maximization of the same can be achieved by minimizing the negative criterion\textit{ -f(x)} \cite{goodfellow-et-al:deep-learning}. When the minimization is considered, the objective function is also referred to as \textbf{loss function} or \textbf{error function} or \textbf{cost function}.

\subsection{Related Works}
The \textbf{gradient descent} algorithm \cite{cauchy:gradient-descent} has been the most popular algorithm for performing mathematical optimization. It is an iterative algorithm which deduces the direction to move towards at any given particular instant by using the sign of the local gradient of \textit{f(x)} wrt \textit{x}. The update equation of gradient descent is given by:

\begin{center}
	$x_{t + 1} = x_{t} - \alpha $ $\cfrac{df(x_t)}{dx}$
\end{center}

where the $\alpha$ is known as the \textbf{learning rate} which specifies the step-size for any particular iteration of the algorithm. The most common method for choosing the value of $\alpha$ that has been applied is trial and run; and thereby the algorithm requires human attention.

Apart from its heavy reliance on a perfectly chosen learning rate, it was pointed out that the algorithm is susceptible to \textbf{ravines}, i.e. variable gradient rates along different dimensions \cite{sutton:gradient-descent-problems}. Over the years, various attempts have been made in order to patch up these flaws of the gradient descent algorithm. The use of \textbf{Momentum} in the update equation of gradient descent was an attempt at tackling the latter problem \cite{qian:momentum}. The update equations for the momentum are given by

\begin{center}
	$v_t = \gamma v_{t - 1} + (1 - \gamma) \cfrac{df(x_t)}{dx} $\\
	$x_{t + 1} = x_{t} - \alpha v_t$
\end{center}

where the $\gamma$ is known as the momentum weightage or the running average factor. In some literature, the $\gamma$ is also denoted by the symbol $\beta$, the meaning of both the symbols is however the same. The momentum modification takes into consideration the values of gradients of the previous iterations and accumulates them in the $v$ term. Unfortunately, in order to evade the problem of ravines, the momentum makes a trade off with the addition of another hyperparameter $\gamma$.

The Nesterov Accelrated Gradient or \textbf{NAG} \cite{nesterov:momentum} builds upon the concept of momentum and adds a future lookup via the accumulated gradients in order to make a better estimate of the optimal direction to move towards. The \textbf{RMSprop} optimization scales the current gradient by the inverse square root of accumulated second moments of the previous gradients. The current standard and the most widely employed algorithm \textbf{Adam} \cite{kingma-ba:adam} combines the concept of Momentum and RMSprop coupled with learning rate decay. The \textbf{Nadam} variant of the same, which uses the Nesterov Momentum, is also sometimes used for optimization. The systematic update equations of Adam are given by:

\begin{center}
	$g_t = \cfrac{d f(x_t)}{dx}$ \\
	$m_t = \beta_1 m_{t-1} + (1 - \beta_1) g_t$ \\
	$v_t = \beta_2 v_{t-1} + (1 - \beta_2) g_t^2$ \\
	$\hat{m_t} = \cfrac{m_t}{(1 - \beta_1^t)}$ \\
	$\hat{v_t} = \cfrac{v_t}{(1 - \beta_2^t)}$ \\
	$\hat{\alpha} = \alpha \cfrac{\sqrt{1 - \beta_2^t}}{1 - \beta_1^t}$ \\
	$x_{t + 1} = x_{t} - \hat{\alpha} \cfrac{\hat{m_t}}{(\sqrt{\hat{v_t}} + \epsilon)}$\\
\end{center}

There are in all four hyperparameters in the Adam update algorithm viz. $\alpha$, $\beta_1$, $\beta_2$ and $\epsilon$ of which, the $\epsilon$ is used for the numerical stability of the algorithm and is rarely tweaked. The default value used for $\epsilon$ is \textit{1e-8}.

There are various other algorithms that have been devised for the problem of Mathematical Optimization and have been utilised with varying rates of success; whereby, they all have their own advantages as well as shortcomings \cite{rudder:overview}. Some approaches based on statistical schedules such as \cite{darken:schedule} and using annealing \cite{robbins:annealing} have been published. Novel approaches such as the \cite{koolen:learning-learning-rate} and \cite{schaul:pesky} for the \textbf{stochastic gradient setting}, where update is made per data example, prominently stand out, but unfortunately it is felt that they add up redundant complexity to the task of Mathematical Optimization. Works that involve the use of \textit{\textbf{Higher Order Derivatives}} or \textit{\textbf{Hessians}} in the update equations that follow the lines of \textbf{Newton's Method} are not relevant to the present research and hence not compared.

\subsection{Comparative analysis}
In almost all these gradient descent variants, it occurs that as much of efforts that have been put towards making the algorithm stabler and more performant, have entailed increment of hyperparameters to the update equations, resulting in lesser autonomy. The statistical approaches that guide the selection of these hyperparameters fit the relevant domains perfectly but require the same efforts to be reproduced for disparate domains. This brings to highlight the two key factors of the optimization algorithm to be presented here: \textbf{simplicity} due to the use of only first order derivatives and simplistic geometric approximations without any momentum accumulation; and \textbf{autonomy} because of not requiring any hyperparameters; while making only one assumption about the loss function being positive real valued \footnote{The loss function for all the Machine Learning and Deep Learning tasks are almost always defined as positive real valued functions}.

\section{Mathematical explanation of the Algorithm}
This section provides a step by step description of the proposed algorithm for performing Mathematical Optimization.
Following sub-sections would present the update equation of the algorithm and also explain the mathematics supporting it. Followed by, the analysis of the parameter update portion of the equation and primary simulations on common known mathematical functions.

\subsection{Proposed Algorithm}
The algorithm proposed by the present research has the same procedure as that of gradient descent. Precisely, the algorithm starts by initializing the trainable parameters $x$ randomly \footnote{There are various distinct methods proposed for initialization. The main motive behind the random parameter initialization is breaking the symmetry among them.} in order to make an initial guess and then proceeds iteratively by updating the parameters towards better values (Algorithm \ref{alg:optimization}).

\begin{algorithm}[!htb]
   \caption{Proposed Optimization}
   \label{alg:optimization}
\begin{algorithmic}
   \STATE {\bfseries Input:} data ($x_i$, $y_i$), parameters $W$
   \STATE Initialize $W$ randomly
   \REPEAT
   \STATE \textbf{Forward Pass} $loss = l(f(x_i; W), y_i)$
   \STATE \textbf{Backpropagation} calculate $\cfrac{df(x_i)}{dW}$
   \STATE \textbf{Update params} $W = RU(W, loss, \cfrac{df(x_i)}{dW})$
   \UNTIL{$epoch$ $\leq$ $totalEpochs$}
\end{algorithmic}
\end{algorithm}

There is a modification proposed in the update equation used for iteratively improving the parameters, termed $RU$ i.e. Relative updation. The update equation is given by:

\begin{center}
	$\boxed{x_{t + 1} = x_{t}  - \cfrac{f(x_t) \cfrac{df(x_t)}{dx}}{f(x_t) + \left(\cfrac{df(x_t)}{dx}\right)^2}; \forall x_t \in \mathbb{R}, f(x_t) \geq 0 }$

\end{center}

It is important to note that the $\left(\frac{df(x_t)}{dx}\right)^2$ corresponds to the squared derivative as opposed to the second order derivative denoted by $\frac{d^2f(x_t)}{dx^2}$. The $f(x_t)$ term corresponds to the value of the objective function at the $t^{th}$ iteration of the algorithm. The only assumption made by the algorithm is that the cost function defined for this optimization task is a positive real valued function.

The intuition behind using the cost term in the update equation draws inspiration from the \textbf{\textit{'General Theory of Relativity'}} put forth by Albert Einstein \cite{einstein:relativity}. The notion of unified existence of space and time, term coined as spacetime, is the driving motivation of the update term of this algorithm. As it was pronounced by Einstein, that space and time are not distinct but relative to each other, it is hypothesized that \textit{'the dimensions of the objective function and its constituent parameters are not distinct, but relative to each other'}. It can be noted that in none of the prevailing algorithms, the cost term is used in the update equation; which have treated these dimensions as being absolute. The \textit{'General Theory of Relativity'} explains motion by the existence of a curved or warped spacetime around the moving objects. This setting highly resonates with the curvature of the objective function being non-convex.

Another source of inspiration behind the update term of the proposed algorithm that needs to be mentioned is the \textbf{\textit{Newton-Raphson}} method of finding roots of arbitrary polynomials \cite{akram:newton-raphson}. The \textit{Newton-Raphson} algorithm is an iterative algorithm that updates the value $x$ such that it moves towards the roots of the polynomial $p(x)$, i.e. the value of $x$ where $p(x) = 0$. The update equation is given by:

\begin{center}
	$x_{t + 1} = x_{t} - \cfrac{p(x_{t})}{p'(x_{t})}$\\
	where, $p'(x_{t}) = \cfrac{dp(x_{t})}{dx}$
\end{center}

For any given instant, the \textit{Newton-Raphson} algorithm associates a linear line that corresponds to the tangent of the polynomial curve at the point $(x_t, p(x_t))$ to that point and extrapolates it till it cuts the x-axis, i.e. $y = 0$ line, and uses this length to make an update. This algorithm has been used tremendously for sloving non-square and non-linear mathematical problems for years. The influence of the \textit{Newton-Raphson} method on the proposed equation is easily evident from the function value term in the update portion and the inverse proportional relation of the update portion with the gradient. It needs to be noted that although the \textit{Newton-Raphson} method seems to be highly applicable in our context of optimization instead of the intended root-finding; due to the assumption of $p(x)$ ($f(x)$ in broader sense) being a positive real valued function, which implies that any root of the function must also correspond to the minima; there is still another subtle assumption that \textit{Newton-Raphson} method imposes. This assumption is: the existence of a real root to the $p(x)$. This is a very stringent assumption and cannot be made in the context of Machine Learning optimization problems. The assumption of existence of a global minimum corresponding to a root implies that there would always exist a certain configuration of the parameters of model that fits the data perfectly for every problem. This is definitely not true and in fact, in practical settings, one has to settle at a local minimum that works decently and also generalises well to unseen data examples. From the $\frac{p(x_t)}{p'(x_t)}$ term, it is evident that the \textit{Newton-Raphson} method is unstable at a point of local minimum. Precisely, at the point of local minimum, the gradient $p'(x_t) = 0$ while the $p(x_t)$ would have a real value leading to a fraction that has $0$ in the denominator. This causes the update term to explode to $\infty$. Thus the \textit{Newton-Raphson} algorithm cannot be directly used for optimization. The \textit{Newton-Raphson} method however can be used to optimize a twice differentiable function by performing root-finding on the derivative of the original function. But, as mentioned earlier, since this invovlves second order derivatives, it cannot be compared to the proposed algorithm.

\subsection{Update term gradient analysis}
The update portion of the proposed algorithm can be isolated in order to gain better insights about it. Mathematically,

\begin{center}
	Let, $z = u(x, y) = \cfrac{xy}{x + y^2}; \forall x \in \mathbb{R}, x \geq 0$
\end{center}

\begin{figure}[ht]
\begin{center}
\includegraphics[scale=1]{diagrams/update_term_surface.png}
\end{center}
\caption{The 3D surface illustration of the update function $u(x, y)$ }
\label{fig:figure_1}
\end{figure}

Where, $x$ has the role of the instantaneous cost and $y$ behaves as the gradient. The behaviour of this function can be analysed by considering the 3D surface formed by the function (Figure \ref{fig:figure_1}) \footnote{The figure is generated using the online tool \\ \url{https://academo.org/demos/3d-surface-plotter}}. The figure is a still shot of the surface from an explanatory angle. It is evident that the surface tapers toward the $z = 0$ plane as we go away in either directions in the $y-axis$. This means that the update slows down if the slope becomes too much, i.e. too steep; a behaviour that is desired. Also, the surface cuts the $z = 0$ plane exactly at $y = 0$. This shows that the equation is stable and will converge when the derivative becomes $0$. Finally, the most important feature is that the properties of these taped curves are controlled by the $x$ dimension. As the cost becomes $0$, the $z$ approaches a singularity, i.e. when both $x = 0$ and $y = 0$, the function produces a $\frac{0}{0}$ form. Mathematically,
\begin{center}
		$$\lim_{x \to 0, y \to 0} \left(u(x, y)\right) = \cfrac{xy}{x + y^2} = \phi$$
\end{center}

The point where this singularity occurs, i.e. $(x=0, y=0)$, is the point of global minimum, where the cost is $0$ (a root) and the derivative being $0$ ensures a smooth touch of the cost function to the parameter dimensions' plane. The chances of reaching this point are very less. Through the experimental simulations, it was observed that in the context of computer based numerics, the updated parameters in spite of being ridiculously close, never exactly reach this point due to the round-off effect. The subsequent sub section sheds further light over this phenomenon. Although it is not required, but to ensure numerical safety, a very small value similar to the Adam optimizer can be added to the denominator. This modifies the function as,
\begin{center}
	$z = u(x, y) = \cfrac{xy}{x + y^2 + \epsilon}; \epsilon \leq 10^{-8}$
\end{center}

The addition of the $\epsilon$ gives an oscillating nature to the algorithm. When the algorithm reaches very close to the point of the global minimum (the singularity), the values of the parameters would just oscillate in the $\epsilon$ delta range and would never yeild the $\frac{0}{0}$ value. This is the reason why the $\epsilon$ value has to be very small in order to achieve a good enough approximation.

Another way to visualize the update function $u(x, y)$ is by comparing it with the gradient descent update term. Upon equivalence comparison of the update terms of the two algoriths, it can be deduced that,
\begin{center}
	$\alpha = \cfrac{f(x_t)}{f(x_t) + \left(\cfrac{df(x_t)}{dx}\right)^2}$
\end{center}

This equation yeilds the geometric approximation of the \textit{learning rate} of the gradient descent algorithm. At every iteration $t$ of the proposed algorithm, it emulates the gradient descent behaviour by automatically approximating a value of the step-size (\textit{learning rate}) and uses the sign and magnitude of the instantaneous slope (given by derivative) to make an update.

\subsection{Simulation on single variable synthetic functions}
The proposed algorithm was tested on numerous single variable mathematical functions. This section provides the results obtained on two of those functions. First function is the square function since it is very well behaved, i.e. continuous and differentiable function, corresponding to a preliminary \textit{best-case}. The second function discussed here is the exponential function which represents the most skewed continuous function. It is important to test the algorithm on the $e^x$ function due to its property of being immune to differentiation.

\subsubsection{Square function}
\begin{center}
	Let, $y = f(x) = x^2$ be the objective function
\end{center}

\begin{figure}[h]
\begin{center}
\includegraphics[scale=0.5]{diagrams/square_function.png}
\end{center}
\caption{2D $y$ v/s $x$ plot of the square objective function}
\label{fig:figure_2}
\end{figure}

Upon simulating the proposed algorithm on this function with an initial point $x = 1000$ for just $150$ iterations, the following instantaneous cost plot was obtained (Figure \ref{fig:figure_3}).

\begin{figure}[h]
\begin{center}
\includegraphics[scale=0.5]{diagrams/ranik_on_square.png}
\end{center}
\caption{2D Cost v/s Iteration plot of the simulation on square function}
\label{fig:figure_3}
\end{figure}

Final optimised position and cost were:\\
$x = 5.493336358815607$ x $10^{-16}$\\
$y = 3.0176743$ x $10^{-31}$\\

for the theoretical (actual) expected values of $x = 0$ and $y = 0$. While, the algorithm reached the $x$ value of the order of $10^{-3}$ in just the initial 30 iterations.

\subsubsection{Exponentiation function}
\begin{center}
	Let, $y = f(x) = e^x$ be the objective function
\end{center}

\begin{figure}[h]
\begin{center}
\includegraphics[scale=0.5]{diagrams/exponentiation_function.png}
\end{center}
\caption{2D $y$ v/s $x$ plot of the exponentiation objective function}
\label{fig:figure_4}
\end{figure}

Simulating the same algorithm on the exponentiation function this time, with an initial point $x = 10$ for $100$ iterations, yielded the following instantaneous cost plot (Figure \ref{fig:figure_5}).

\begin{figure}[h]
\begin{center}
\includegraphics[scale=0.5]{diagrams/ranik_on_exponentiation.png}
\end{center}
\caption{2D Cost v/s Iteration plot of the simulation on exponentiation function}
\label{fig:figure_5}
\end{figure}

with the final optimised position and cost being:\\
$x = -4.47519719694$\\
$y = 0.0115184$\\

for the theoretical (actual) expected values of $x = -\infty$ and $y = 0$.

The function $f(x) = e^x$ has an oblique property of being unchanged by the differentation operator, i.e.
\begin{center}
	$\cfrac{d(e^x)}{dx} = e^x$
\end{center}
In spite of which, the algorithm proved it's stability during simulation and displayed consistent behaviour in the numerical calculations. Unfortunately the initial position for $x$ could not be set higher, due to the inability of the programming framework to handle values of the order of $e^{20}$.

\section{Experimentation}
In order to test the practical soundness of the proposed algorithm, it was tested on the \textbf{MNIST} \footnote{\url{http://yann.lecun.com/exdb/mnist/}} dataset, which is regarded as the \textit{'Drosophila'} of Machine Learning \cite{goodfellow-et-al:deep-learning}. The classifier that is used is a $3$ layers deep Neural Network having hidden representation size of $512$ dimensions with ReLU activation function \cite{nair:relu}. The use of batch normalization \cite{ioffe:batch-normalization} is avoided since the network is quite shallow and the input data is normalised. The data distribution wouldn’t shift too much in just three layers giving enough scope for ReLU to create non-linear boundaries. No regularization has been employed since the focus is on the optimization part and not the generalisation of the classification. The optimization was performed in the mini-batch gradient descent settings with a batch size of $64$.

The programming implementation of this experiment and the simulations in the previous section are made using the TensorFlow framework \cite{abadi:tensorflow} and have been made open source at the repository [\url{link}] \footnote{For anonymity, the link has been redacted.}. The loss plot shown in (Figure \ref{fig:figure_6}) is obtained after running the algorithm for 12 epochs. The important configuration of the algorithm that needs to be mentioned here is the initialization of the weights. This experiment uses the Xavier initializer \cite{glorot:xavier}.

\begin{figure}[h]
\begin{center}
\includegraphics[scale=1.2]{diagrams/ranik_xavier_paper.png}
\end{center}
\caption{2D Cost v/s Iteration plot of the described experiment}
\label{fig:figure_6}
\end{figure}

(Figure \ref{fig:figure_7}) denotes that the performance of the proposed algorithm is comparable to Adam Optimization. This brings to highlight that recently, a number of problems with the Adam optimizer have been highlighted \cite{anonymous:adam-problem}, of which the most prominent being that adam is not guaranteed to converge. Due to which, the analysis of the proposed algorithm becomes more pronounced.

\begin{figure}[h]
\begin{center}
\includegraphics[scale=1.2]{diagrams/ranik_vs_adam_paper.png}
\end{center}
\caption{Comparison of Cost plots of the proposed algorithm and the Adam Optimizer}
\label{fig:figure_7}
\end{figure}

The proposed algorithm was compared alongside a number of other optimizers (more details in [\url{link}]), see (Figure \ref{fig:figure_8}) and it was observed that, majority of the other optimizers without careful tuning of their hyperparameters perfrom a lot worse than the proposed algorithm.

\begin{figure}[h]
\begin{center}
\includegraphics[scale=1.2]{diagrams/ranik_vs_all_paper.png}
\end{center}
\caption{Comparison of Cost plots of the proposed algorithm and other prevailing optimizers}
\label{fig:figure_8}
\end{figure}

\begin{figure}[h]
\begin{center}
\includegraphics[width=1.0 \linewidth]{diagrams/histograms_ranik_tn_paper.png}
\end{center}
\caption{Histograms of the distributions of the trainable parameters in the Network}
\label{fig:figure_9}
\end{figure}

Another key distinction that is observed as described in (Figure \ref{fig:figure_9}) is that the distribution of the trained parameters for the proposed algorithm resemble the \textbf{\textbf{Laplacian Distribution}} as opposed to the \textbf{\textit{Gaussian Distribution}} trained by the Adam Optimizer.

\section{Conclusions}
The research attempts to establish a hypothesis that the \textit{'dimensions of the objective function and the constituent parameters are relative'}, and paves way for future analysis of this hypothesis. Given the promising results in the described experiments it would be interesting to see haw far can it go for bigger models such as CNN, ResNet, RNN etc. for other more robust Deep Learning datasets. The proposed algorithm without employing any \textit{momentum}, or \textit{RMSprop} mechanisms and utilising simple geometric approximations, achieves performance  comparable to the optimizers that use \textit{momentum }and \textit{RMSprop}. With this, it is urged that the further research in this direction should give more importance to simplicity.

% In the unusual situation where you want a paper to appear in the
% references without citing it in the main text, use \nocite
% \nocite{langley00}

\bibliography{fafomo}
\bibliographystyle{icml2018}

\end{document}

% This document was modified from the file originally made available by
% Pat Langley and Andrea Danyluk for ICML-2K. This version was created
% by Iain Murray in 2018. It was modified from a version from Dan Roy in
% 2017, which was based on a version from Lise Getoor and Tobias
% Scheffer, which was slightly modified from the 2010 version by
% Thorsten Joachims & Johannes Fuernkranz, slightly modified from the
% 2009 version by Kiri Wagstaff and Sam Roweis's 2008 version, which is
% slightly modified from Prasad Tadepalli's 2007 version which is a
% lightly changed version of the previous year's version by Andrew
% Moore, which was in turn edited from those of Kristian Kersting and
% Codrina Lauth. Alex Smola contributed to the algorithmic style files.