%\setcounter{page}{900}

\chapter{Applications of Definite Integrals I: General Arguments
\label{AppsDefIntegrals}}

Here we look at many further quantities which give rise to
antidifferentiation.

Most modern calculus textbooks contain numerous excellent examples
of applications of definite integrals.  Indeed, most examples
which are likely to be seen in further studies of the physical
sciences can trace back to calculus textbook-type problems.

Here we will make an attempt to accomplish the presentations
of the usual topics, and others.  We will also
do the following:

\begin{enumerate}
\item Re-introduce the notion of infinitesimals into the
physical analysis of these problems.  This was a traditional
approach which has fallen out of favor.  While we will refer
back to the Riemann sums for each case, that will be more
for a ``spot-check'' of the reasoning behind the infinitesimals,
and perhaps some proofs.  However, the first introduction to
most topics will be through infinitesimals.  Besides, they
make for prettier pictures!

Students are unlikely to be inspired by the Riemann sum proofs,
which are often used to show that the quantity represented
by the integral has the integrand as derivative.  The proofs
are technical, and leave a student to believe he would never
come up with it himself.  The differentials ``cut to the chase,''
and can be proved later after guessed, rather than derived from
Riemann sums.

\item Finite Riemann sums used for numerical approximations of
the quantities involved.  This contains all the intuition
(short of the proofs) contained in the most textbook developments
of these integrals.

\item Explanations of why some guesses for the infinitesimals
will not work.

\item Explanation of how to tell---by sight---if a particular
differential is correct, and whether the Riemann sum form
will actually converge to the desired quantity as the partition
is refined.
\end{enumerate}

%Recall that we already gave one argument for two situations where
%a given quantity can be represented by a definite integral:
%\begin{align}
%   s\left(t_f\right)-s\left(t_0\right)
%        &=\int_{t_0}^{t_f}a(t)\,dt,\label{S(T_F)-S(T_O)ForDefIntI}\\
%   v\left(t_0\right)-v\left(t_0\right)
%        &=\int_{t_0}^{t_f}a(t)\,dt.\label{V(T_F)-V(T_O)ForDefIntI}
%\end{align}
%This was just the working definition
%of the definite integral,
%\begin{equation}\int_a^bf(x)\,dx=F(b)-F(a),\label{FundTheoremAsWorkingDef}
%\end{equation}
%assuming $f(x)$ is continuous on $[a,b]$ and $F'(x)=f(x)$ on $[a,b]$.
%As a matter of fact, (\ref{FundTheoremAsWorkingDef}) is not the actual
%definition of the definite integral $\int_a^bf(x)\,dx$.  Indeed,
%the definition is more complicated.  However, it is quite useful.

\section{Riemann Sums and Approximations of Cumulative Quantities}

Suppose we had some data on the velocity of an object, and
we wish to approximate its net displacement over a time interval.
Suppose the data we have is the following:

%\begin{tabular}{m{.4in}|m{.3in}|m{.3in}|m{.3in}|m{.3in}|m{.3in}|%
%m{.3in}|m{.3in}|m{.3in}|m{.3in}|m{.3in}|}
%\cg $t=$&\cg0&\cg1&\cg2&\cg2.5&\cg3&\cg4&\cg6&\cg7&\cg8.5&\cg10%\\
%\cg $v=$&\cg10.9&\cg9.6&\cg8.9&\cg8.775&\cg8.8&\cg9.3&\cg12.1&\cg14.4
%               &\cg18.975&\cg24.9
%\end{tabular}

\section{Other Complications}
Consider cases where the function is only piecewise continuous,
and try to recover a continuous antiderivative.
Consider, perhaps, some cases from electricity and magenetism
regarding fields or potentials across interfaces.

Consider two ``antiderivatives'' of
$$f(x)=\left\{\begin{aligned}1,\qquad&x>0,\\
                           -1,\qquad x<0.\end{aligned}\right.
$$
One is continuous, the other not.

Can always recover a continuous antiderivative from a piecewise continuous
function, so long as we don't have vertical asymptotes, for instance.


\section{KFAC: Block-diagonal inverse approx, $\breve{F}^{-1} \approx \tilde{F}^{-1}$}
\frame{\tableofcontents[currentsection, hideothersubsections]}

\begin{frame}
\frametitle{KFAC: Block-diagonal inverse approx, $\breve{F}^{-1} \approx \tilde{F}^{-1}$}
\begin{figure}
    \centering
    \includegraphics[scale=0.275]{kfac_08}
\end{figure}
NOTE: this is equivalent to approximating Fisher itself as block-diagonal
\end{frame}

\begin{frame}
\frametitle{KFAC: Block-diagonal inverse approx, $\breve{F}^{-1} \approx \tilde{F}^{-1}$}
\begin{figure}
    \centering
    \includegraphics[scale=0.275]{kfac_09}
\end{figure}
\end{frame}

\begin{frame}
\frametitle{KFAC: Block-diagonal inverse approx, $\breve{F}^{-1} \approx \tilde{F}^{-1}$}
{\footnotesize
Left to right: \\
$\tilde{F}^{-1}$, its approximations $\breve{F}^{-1}$ (top) and $\hat{F}^{-1}$ (bottom), their absolute difference
}
\begin{figure}
    \centering
    \includegraphics[scale=0.225]{kfac_12}
\end{figure}
\end{frame}

% \begin{frame}
% \frametitle{KFAC: Block-diagonal inverse approx, $\breve{F}^{-1} \approx \tilde{F}^{-1}$}
% Left to right: \\
% $\tilde{F}$, its approximations $\breve{F}$ (top) and $\hat{F}$ (bottom), their absolute difference

% \begin{figure}
%     \centering
%     \includegraphics[scale=0.175]{kfac_10}
% \end{figure}

% \begin{itemize}
%     \item the off-tridiagonal blocks of the bottom right matrix, while being very close to zero, are
%     actually NON-zero (hard to see from the plot)
%     % \item the plot is of the absolute values of the entries
% \end{itemize}
% \end{frame}


\title{Self Organizing Systems Exercise 1}
\author{
        Alexander Dobler 01631858\\
        Thomas Kaufmann 01129115
}
\date{\today}

\documentclass[12pt]{article}

\usepackage{hyperref}
\usepackage{booktabs}
\usepackage{graphics}
\usepackage{multirow}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{mwe}

\begin{document}
\maketitle

\section{Introduction \& Problem Description}
For exercise 1 of self-organizing systems we chose the task \textit{Sequence alignment for Genetic Data (DNA Lattice) Anonymization} in which we should solve the DNA lattice anonymization described in \cite{mainpaper} with two metaheuristic techniques from the lecture.
The task is to find a pairing of DNA sequences, such that the sum of distances between two DNA sequences of a pair over all pairs is as small as possible.

More specifically we are given a set of $n$ sequences described by strings which can have different length.
In a first step we have to align these sequences, such that all sequences have the same length.
This is done by introducing \textit{gap}-characters to increase the length of sequences.
In general this process is called multiple sequence alignment (MSA) and we do not describe how this is done here, but rather use a library as a black-box tool for this step.
Now, that every sequence has the same length, we can compute the distance between two sequences as described in \cite{mainpaper}.
The last and main step is to combine this set of sequences into pairs, such that the sum of distances of two sequences of a pair summed up over all pairs is minimal.
Obviously this is just an application of minimal weighted matching in a complete graph, where a graph is represented by $G=(V,E)$ as follows.
The set $V$ of nodes are described by the sequences and the set $E$ of edges is $V\times V$.
For an edge $e=\{u,v\}$ its weight $w(e)$ is just the distance between the sequences $u$ and $v$.
We denote by $M \subset E$ a complete matching on a graph $G$, s.t. $2 \times |M| = |V|$, and by $c(M)$ the corresponding weight of the matching.

In the next sections we describe our solution approaches and main results.

\section{Test Data \& Preprocessing}
\label{sec:test-data}
As base set of data we chose DNA sequences from \url{https://www.kaggle.com/neelvasani/humandnadata} which consists of over 4000 human DNA sequences.
In a next step we created multiple instances of different size by selecting 10-300 random samples of these sequences.
Test-case sizes are always even, such that we do not have to bother about the leftover single sequence.
For each of these instances we performed some preprocessing with the python module \textit{Bio.SeqIO} from the package \textit{Bio} (\url{https://biopython.org/wiki/SeqIO}) and as suggested in ~\cite{mainpaper} compute multiple sequence alignments with the MSA-toolkit \emph{ClustalW}~\cite{clustalw}.
In the last step we compute the cost-matrix between pairs of sequences as described in \cite{mainpaper}.
All of the algorithms described in the next section only use the cost-matrix to compute a pairing.
Although we chose instances of sizes comparable to the work of Bradley~\cite{mainpaper}, as shown below, instances turned out being relatively easy to solve where even the relatively simple construction heuristic obtains high quality solutions in little to no execution time. We then further investigated this behavior in more depth and found that a specially structured cost matrix due to the tree-based alignment procedure in \emph{ClustalW} often leads to edge-costs of $0$ between specific pairs in the graph, inherently favouring the nature of the DNALA construction heuristic.

These test-cases can be found in the project under the folder \textit{data}:
Sequence alignments for each test-case are stored in the files \textit{human\_data\_XX.fasta} where \textit{XX} denotes the size of the test-case.
Similarly \textit{human\_data\_XX.cm} stores the cost-matrices in \textit{pickle}-format (\url{https://docs.python.org/3/library/pickle.html}).

\section{DNALA \& Exact Method}
We provide two preliminary methods to solve this problem which are used to benchmark the metaheuristik techniques:
\begin{itemize}
    \item An implementation of the DNALA algorithm as described in \cite{mainpaper} can be found in the \textit{algorithms} directory.
    We did implement the described randomness, but do not use multiple runs of the algorithm, but instead only run the algorithm for a testset once to determine its capability.

    \item As DNALA is only a heuristic and is not guaranteed to find an optimal solution we furthermore use a maximum weighted matching implementation provided by the package \textit{networkx} (\url{https://networkx.org/documentation/stable//index.html}) to compute an exact solution used for optimality gaps in benchmarking.
\end{itemize}

\section{Genetic Algorithm}
The first metaheuristic technique with which we solve the problem is a genetic algorithm.
For this we use the \textit{deap}-package for python (\url{https://deap.readthedocs.io/en/master/}) which provides a framework for creating genetic algorithms.
The well-know genetic algorithm compononents are implemented as follows:
\begin{itemize}
    \item \textbf{Solution representation}: A solution consists of $\frac{n}{2}$ pairs such that each node (sequence) appears in exactly one pair.
    \item \textbf{Fitness}: The fitness is just the sum of distances between pairs of points.
    This in fact also represents the value of the corresponding weighted matching.
    \item \textbf{Crossover}: Given a pair of individuals $M_i$ and $M_j$, we derive a successor individual $M_{i'}$ with the following procedure:
    \begin{enumerate}
    	\item Select a subset $M'_i \subset M_i$ of matchings from individual $M_i$, where each edge $e \in M_i$ is selected with a probability of $0.5$.
    	\item We then try to identify matchings $e \in M_j$ composed of edges not contained in $M'_i$, which are entirely preserved for the offspring $M_{i'}$.
    	\item Finally, we identify the remaining unmatched vertices and pair them randomly.
    \end{enumerate}
    It is worth to notice that different variations of this approach were tested, considering orders of matchings in the solution representation as well as alternative strategies to pair remaining vertices, but no significant improved was obtained.
    \item \textbf{Mutation}: Given an individual $M$, selects a random pair $e=\{u,v\}$, $e'=\{u',v'\} \in M$ of matchings based on a given mutation probability and constructs an offspring $M'$ by performing 1) an arbitrary or 2) the best two-opt in the subgraph induced by vertices $V=\{u,v,u',v'\}$. Experiments showed slight advantages for the intensifying mutation approach (i.e. the best two-opt neighbour) at only a negligible increase in computational cost.
\end{itemize}
Furthermore we used a tournament selection strategy with tournament size of $k=3$ and have the option to select different population sizes and mutation rates for running the algorithm.

\section{Ant Colony Optimization}
At first we did not know how to solve the problem with ant colony optimization.
But then we realized that a weighted matching in a complete graph is just a tour visiting every vertice, where every second edge will have weight 0.
This was really convenient, as ant colony optimization is well-known to perform well on the TSP-problem.
Furthermore there are a lot of implementations available, which provide ACO-methods to solve the TSP-problem.
For our purposes it was enough to alter the implementation provided by the \textit{pants}-package (\url{https://pypi.org/project/ACO-Pants/}) in a way, such that we could solve the minimum weighted matching problem.

Our alteration can be described as follows.
When solving the TSP-problem every ant starts at a specific node and tries to find a best tour.
This means that at a specific point of the algorithm each ant has currently visited an acyclic path.
Now this path has either even or odd length.
This means when an ant can chose its next edge there are two different strategies:
\begin{itemize}
    \item If the path until now has even length, then choose the usual strategy to select the next node to visit (pheromones in ACO with $\alpha$- and $\beta$-values).
    \item If the path until now has odd length, then go to any not yet visited node.
    This resembles the fact that every other edge of the tour will have weight 0.
\end{itemize}
Of course we also have to alter the cost of a tour, in particular that every other edge has weight 0, to guide the algorithm to an optimal solution.

One might think that this construction of an algorithm to solve the minimum weighted matching problem is pretty superficial, but we will see that its performance is not too bad.

\section{Local Search}
While population based metaheuristics are usually great to identify high quality solution components in widely distributed solution spaces, they tend to end up in suboptimal regions, where simple intensification procedures like local search heuristics can significantly improve the solution quality. To this end, it is so common that population based metaheuristics are combined with local search procedures that for genetic algorithms the term \emph{memetic algorithm} has been established in the literature. In this work, we used a relatively simple two-opt neighbourhood structure with a constant time neighbour evaluation scheme and a first-improvement step function to improve populations of both the ACO as well as the GA.

\section{Results \& Conclusion}
To evaluate the described approaches, experiments with a set of $12$ differently sized instances were run for different kinds of algorithm configurations.
We used the optimality gap as a scale invariant performance measure describing the relative distance to the global optimum.
As for particularly large instances, some configurations did converge towards the global optimum.
All experiments were run with a wallclock time of $300 s$ and $5$ repetitions each for statistical stability. Execution times do not include preparation time of cost matrices, since they have been precomputed and stored for reuse. All experiments were run on a Windows 10 machine with AMD Ryzen 3700X CPU in single-threaded mode.

\subsection{Comparison of GA, ACO and DNALA}

Table~\ref{tab:main} compares both the GA as well as the ACO to the DNALA baseline, where we show the median values, for the optimality gap, the execution time as well as the iteration where the best solution was obtained.

Main observations:
\begin{itemize}
	\item Purely population-based metaheuristic approaches work quite well for moderate sized instances, but solution quality declines significantly with increasing instance sizes. While for smaller instances, some instances could even be solved to optimality, for large instances the gap increases even above $100\%$ optimality gap.
	\item Both approaches show the same behaviour with respect to the overall number of iterations conducted in the given period, where in smaller instances optimal solutions are obtained relatively fast and as the instance size increases, also the number of iterations until premature termination due to optimality increases. At some point, however, instances become more difficult and more expensive in terms of computational cost, such that the iteration count then steadily decreases, which in turn also affects solution quality.
	\item It can be observed that our GA does not suffer from premature convergence as the iteration where the best solution was obtained tends to be close to the overall iteration count. This suggests that more iterations could still improve the solution quality.
	\item Local search generally improves quality significantly, allowing to solve even larger instances almost to optimality. However, iteration count drops to a level suggesting our GA being basically just a \emph{fancy} random restart procedure.
	\item The effectiveness of two-opt local search	backs up our observation of the biased instance generation procedure with \textit{ClustalW} mentioned in Section~\ref{sec:test-data}, since this simple neighborhood is able to identify the respective pairs of minimal cost easily. Furthermore, DNALA + LS seems to be quite good combtination
\end{itemize}

\begin{table}
\centering
\resizebox{\columnwidth}{!}{%
\begin{tabular}{llr|rrrrr|rrrrr}
\toprule
   &     &          & \multicolumn{5}{|c|}{Without Local Search} & \multicolumn{5}{|c}{With Local Search} \\
   &     &  Optimum &  Fitness &    Gap &   Time &  $I_{opt}$ &  $I_{total}$ &  Fitness &   Gap &   Time &  $I_{opt}$ &  $I_{total}$ \\
ALG & n &          &          &        &        &            &          &       &        &            \\
\midrule
GA & 10  &     1994 &     1994 &   0.00 &   0.00 &          1 &                  1 &     1994 &  0.00 &   0.00 &          0 &                  0 \\
   & 20  &    11758 &    11758 &   0.00 &   0.00 &         13 &                 13 &    11758 &  0.00 &   0.00 &          0 &                  0 \\
   & 30  &    19032 &    19032 &   0.00 &   2.00 &         33 &                 33 &    19032 &  0.00 &   1.00 &          0 &                  0 \\
   & 40  &    20892 &    20892 &   0.00 &   5.00 &         54 &                 54 &    20892 &  0.00 &   3.00 &          0 &                  0 \\
   & 50  &    34198 &    34198 &   0.00 &  18.00 &        124 &                124 &    34198 &  0.00 &   3.00 &          0 &                  0 \\
   & 60  &    42382 &    44060 &   3.96 & 300.00 &        141 &               1795 &    42382 &  0.00 &  10.00 &          1 &                  1 \\
   & 70  &    47234 &    47498 &   0.56 & 300.00 &        221 &               1744 &    47234 &  0.00 &  15.00 &          1 &                  1 \\
   & 80  &    53538 &    53538 &   0.00 &  62.00 &        291 &                347 &    53538 &  0.00 &  23.00 &          2 &                  2 \\
   & 90  &    69731 &    70489 &   1.09 & 300.00 &        477 &               1322 &    69731 &  0.00 &  36.00 &          2 &                  2 \\
   & 100 &    83495 &    90825 &   8.78 & 300.00 &        314 &                314 &    83495 &  0.00 &  56.00 &          3 &                  3 \\
   & 150 &   104772 &   164686 &  57.19 & 300.00 &        141 &                141 &   104772 &  0.00 & 183.00 &          6 &                  6 \\
   & 200 &   130178 &   285042 & 118.96 & 300.00 &        142 &                142 &   133848 &  2.82 & 300.00 &          7 &                  7 \\
   \midrule
ACO & 10  &     1994 &     1994 &   0.00 &   0.00 &          0 &                  0 &     1994 &  0.00 &   0.00 &          0 &                  0 \\
   & 20  &    11758 &    11758 &   0.00 &   0.00 &          0 &                  0 &    11758 &  0.00 &   0.00 &          0 &                  0 \\
   & 30  &    19032 &    19032 &   0.00 &   0.00 &          1 &                  1 &    19032 &  0.00 &   0.00 &          0 &                  0 \\
   & 40  &    20892 &    20892 &   0.00 &   8.00 &         89 &                 89 &    20892 &  0.00 &   0.00 &          0 &                  0 \\
   & 50  &    34198 &    34280 &   0.24 & 300.00 &       1380 &               1856 &    34198 &  0.00 &   1.00 &          0 &                  0 \\
   & 60  &    42382 &    45370 &   7.05 & 300.00 &        326 &               1358 &    42382 &  0.00 &   1.00 &          0 &                  0 \\
   & 70  &    47234 &    50798 &   7.55 & 300.00 &        361 &               1271 &    47234 &  0.00 &   2.00 &          0 &                  0 \\
   & 80  &    53538 &    60098 &  12.25 & 300.00 &        684 &                775 &    53538 &  0.00 &   3.00 &          0 &                  0 \\
   & 90  &    69731 &    83165 &  19.27 & 300.00 &        500 &                598 &    69731 &  0.00 &   5.00 &          0 &                  0 \\
   & 100 &    83495 &   107569 &  28.83 & 300.00 &        428 &                512 &    83495 &  0.00 &  22.00 &          4 &                  4 \\
   & 150 &   104772 &   157702 &  50.52 & 300.00 &         57 &                194 &   108990 &  4.03 & 300.00 &         18 &                 32 \\
   & 200 &   130178 &   218002 &  67.46 & 300.00 &         49 &                125 &   171176 & 31.49 & 300.00 &         20 &                 24 \\
   \midrule
DNALA & 10  &     1994 &     1994 &   0.00 &   0.00 &          - &                  - &     1994 &  0.00 &   0.00 &          - &                  - \\
   & 20  &    11758 &    11758 &   0.00 &   0.00 &          - &                  - &    11758 &  0.00 &   0.00 &          - &                  - \\
   & 30  &    19032 &    19032 &   0.00 &   0.00 &          - &                  - &    19032 &  0.00 &   0.00 &          - &                  - \\
   & 40  &    20892 &    22066 &   5.62 &   0.00 &          - &                  - &    21164 &  1.30 &   0.00 &          - &                  - \\
   & 50  &    34198 &    35336 &   3.33 &   0.00 &          - &                  - &    34198 &  0.00 &   0.00 &          - &                  - \\
   & 60  &    42382 &    44666 &   5.39 &   0.00 &          - &                  - &    42890 &  1.20 &   0.00 &          - &                  - \\
   & 70  &    47234 &    47252 &   0.04 &   0.00 &          - &                  - &    47244 &  0.02 &   0.00 &          - &                  - \\
   & 80  &    53538 &    55448 &   3.57 &   0.00 &          - &                  - &    53538 &  0.00 &   0.00 &          - &                  - \\
   & 90  &    69731 &    71779 &   2.94 &   0.00 &          - &                  - &    69747 &  0.02 &   0.00 &          - &                  - \\
   & 100 &    83495 &    86513 &   3.61 &   0.00 &          - &                  - &    85293 &  2.15 &   0.00 &          - &                  - \\
   & 150 &   104772 &   105824 &   1.00 &   0.00 &          - &                  - &   104940 &  0.16 &   0.00 &          - &                  - \\
   & 200 &   130178 &   134640 &   3.43 &   0.00 &          - &                  - &   130194 &  0.01 &   0.00 &          - &                  - \\

\bottomrule
\end{tabular}%
}
\caption{Comparison of GA and ACO against the DNALA baseline in $12$ different instances.}\label{tab:main}
\end{table}

\subsection{Comparison of GA Mutation Operators}
The previous section showed that our GA is not subject to premature convergence. However, the effectiveness of the two-opt neighbourhood structure and the fact that improvements occur frequently in the last iterations, we suspected that our GA was actually a multi-solution, random-neighbour local search. To this end, we compared the random two-opt move mutation operator against the best two-opt move one. Table~\ref{tab:mutation-operator} compares median values for fitness, optimality gap, execution time and iteration characteristics for both types for moderate and large instance types.

Main observations:
\begin{itemize}
	\item The randomized approach general performs quite similarly, however, tends to require more iterations for comparable solution qualities (e.g. $n=70$)
	\item For smaller instances, the locally-improving moves seem to be slightly advantageous in terms of convergence pace.
	\item As the instance size increases, the effect of small locally-improving moves seem to vanish and both quality as well as iteration characteristics seem to align.
\end{itemize}

\begin{table}
\centering
\resizebox{\columnwidth}{!}{%
\begin{tabular}{llr|rrrrr}
\toprule
      &     &   Optimum &   Fitness &    Gap &   Time &   $I_{opt}$ &  $I_{total}$  \\
type & n &           &           &        &        &            &                    \\
\midrule
Random & 70  &  47234.00 &  47371.00 &   0.29 & 300.00 &     278.50 &            2203.50 \\
      & 80  &  53538.00 &  55116.00 &   2.95 & 300.00 &     564.00 &            1650.00 \\
      & 90  &  69731.00 &  70490.00 &   1.09 & 300.00 &     599.00 &            1012.00 \\
      & 100 &  83495.00 &  94405.00 &  13.07 & 300.00 &     501.00 &             629.50 \\
      & 150 & 104772.00 & 180576.00 &  72.35 & 300.00 &     149.00 &             149.00 \\
      & 200 & 130178.00 & 280278.00 & 115.30 & 300.00 &     142.50 &             142.50 \\
         \midrule
Best  & 70  &  47234.00 &  47366.00 &   0.28 & 221.00 &     320.00 &            1523.50 \\
      & 80  &  53538.00 &  53538.00 &   0.00 &  88.00 &     295.50 &             364.50 \\
      & 90  &  69731.00 &  71061.00 &   1.91 & 300.00 &     486.00 &            1492.50 \\
      & 100 &  83495.00 &  89561.00 &   7.27 & 300.00 &     401.50 &            1002.50 \\
      & 150 & 104772.00 & 192572.00 &  83.80 & 300.00 &     135.50 &             135.50 \\
      & 200 & 130178.00 & 279480.00 & 114.69 & 300.00 &     143.50 &             143.50 \\
\bottomrule

\end{tabular}%
}
\caption{Comparison of the random and best two-opt move in the GA mutation operator.}\label{tab:mutation-operator}
\end{table}

\subsection{Population Size}
As the name might suggest, population size is obviously a crucial parameter in population-based metaheuristics. On the one hand, an increased population size allows vaster search diversity and allows to cover more areas in the solution space at once, obviously increasing likelihood to identifying new promising regions.
On the other hand, metaheuristics usually require lots of iterations to continuously improve the solution quality, which obviously is a major limiting factor for large population sizes.
In Figure~\ref{fig:population} we compare the impact of different population sizes on the optimality gap over time in single executions on two different instances (usually a time bucket average would be more appropriate for statistical stability, but we assumed this was beyond the scope if this exercise).

Main observations:
\begin{itemize}
	\item Too large population sizes inherently lead to increased computational costs, thus slowing down individual iterations, as can be observed in Figure~\ref{fig:population-b}
	\item The increased population sizes, however, increase search diversity, thus may improve solution quality (compare again Figure~\ref{fig:population-b}). Of course this depends on the structure of the solution space, e.g. big-valley vs. widely distrusted.
	\item Independent of the population size, it can be observed that the GA tends to perform small steps towards improving solutions until convergence towards an (local or global) optimum sets in, while the ACO seems to require large periods to obtain improving solutions. This could be either an indicator for a suboptimal model or some hyper-parameter issue. In a more elaborated study, we would use for instance the R-package irace for proper parameter tuning.
\end{itemize}

  \begin{figure*}
        \centering
        \begin{subfigure}[b]{0.475\textwidth}
            \centering
            \includegraphics[width=\textwidth]{figures/ga_50_population_comparison.pdf}
            \caption%
            {{\small }}
            \label{fig:population-a}
        \end{subfigure}
        \hfill
        \begin{subfigure}[b]{0.475\textwidth}
            \centering
            \includegraphics[width=\textwidth]{figures/ga_100_population_comparison.pdf}
            \caption%
            {{\small }}
            \label{fig:population-b}
        \end{subfigure}
        \vskip\baselineskip
        \begin{subfigure}[b]{0.475\textwidth}
            \centering
            \includegraphics[width=\textwidth]{figures/aco_50_population_comparison.pdf}
            \caption%
            {{\small }}
            \label{fig:population-c}
        \end{subfigure}
        \hfill
        \begin{subfigure}[b]{0.475\textwidth}
            \centering
            \includegraphics[width=\textwidth]{figures/aco_100_population_comparison.pdf}
            \caption%
            {{\small }}
            \label{fig:population-d}
        \end{subfigure}
        \caption
        {\small Optimality gap over time for different population sizes on instances with $n=50$ and $n=100$ vertices. }
        \label{fig:population}
    \end{figure*}

\subsection{Hyper-parameters}
In addition to some manual tweaking of hyper-parameters, we performed a very limited comparison of selected hyper-parameters of both the GA and the ACO.
The default mutation rate corresponds to $2/|V|$, multiplied by a tunable parameter $r \in \{1,4,8\}$. The integer values for alpha and beta define the relative importance of pheromones and distances respectively.

Main observations:
\begin{itemize}
	\item We can clearly see that with too high mutation rate ($r=8$) the genetic algorithm does not converge to the optimum, whereas for $r=1$ and $r=4$ the performance is similar.
	\item For ACO alpha=1 and beta=4 or beta=8 clearly outperforms all other parameter choices, suggesting the importance of distance information rather than pheromones again likely due to specially structured instances.
\end{itemize}

 \begin{figure*}
        \centering
        \begin{subfigure}[b]{0.475\textwidth}
            \centering
            \includegraphics[width=\textwidth]{figures/ga_50_mutation_rate_comparison.pdf}
            \caption%
            {{\small }}
            \label{fig:mean and std of net14}
        \end{subfigure}
        \hfill
        \begin{subfigure}[b]{0.475\textwidth}
            \centering
            \includegraphics[width=\textwidth]{figures/aco_50_alpha_beta_ratio_comparison.pdf}
            \caption%
            {{\small }}
            \label{fig:mean and std of net24}
        \end{subfigure}
        \caption
        {\small Optimality gap over time for different parameters with $n=50$ vertices. }
        \label{fig:mean and std of nets}
    \end{figure*}

\section{Conclusion}
We have seen two metaheuristic techniques to solve the minimum weighted matching problem, namely ACO and genetic algorithms.
Both approaches performed similarly and converged to optimal solutions in appropriate times even for larger instances.

\bibliographystyle{abbrv}
\bibliography{main}

\end{document}


\documentclass[t]{beamer}
\usetheme{Copenhagen}
\setbeamertemplate{headline}{} % remove toc from headers
\beamertemplatenavigationsymbolsempty

\usepackage{amsmath, tikz, bm, tkz-euclide,pgfplots}
\pgfplotsset{compat = 1.16}
\usetkzobj{all}

\title{Equations and Inequalities}
\author{}
\date{}

\AtBeginSection[]
{
  \begin{frame}
    \frametitle{Objectives}
    \tableofcontents[currentsection]
  \end{frame}
}

\begin{document}

\begin{frame}
\maketitle
\end{frame}

\section{Solve linear equations and check solutions.}

\begin{frame}{Solving Equations}
When solving an equation, our goal is to get the variable, usually $x$, alone on one side of the equal sign.	\newline\\	\pause

To do this, we use \alert{reverse order of operations}:	\newline\\	\pause
\begin{enumerate}
	\item<+-> Undo any addition or subtraction.
	\item<+-> Undo any multiplication or division.
	\item<+-> Undo any exponents.
	\item<+-> Get rid of parentheses.
\end{enumerate}
\end{frame}

\begin{frame}{Checking Your Answer}
You can make sure your answer is correct by {\color{blue}\textbf{plugging it in}} to the original problem and seeing if the left side and right side are equal.
\end{frame}

\begin{frame}{Example 1}
Solve each of the following. Round to 2 decimal places.	\newline\\
(a) \quad $3x + 4 = 16$
\begin{align*}
\onslide<2->{3x+4 &= 16 &} \\[6pt]
\onslide<3->{3x &= 12 &\text{subtract 4}} \\[6pt]
\onslide<4->{x &= 4 &\text{divide by 3}}
\end{align*}
\onslide<5->{Check $x = 4$:}
\begin{align*}
\onslide<6->{3(4) + 4 &= 16?} \\
\onslide<7->{16 &= 16}
\end{align*}
\onslide<8->{\[x=4\]}
\end{frame}

\begin{frame}{Example 1}
(b) \quad $-2x-9=17-x$
\begin{align*}
\onslide<2->{-2x-9&=17-x &} \\[6pt]
\onslide<3->{-1x - 9 &= 17 &\text{add $x$}} \\[6pt]
\onslide<4->{-1x &= 26 &\text{add 9}}	\\[6pt]
\onslide<5->{x &= -26 &\text{divide by $-1$}}
\end{align*}
\onslide<6->{Check $x = -26$:}
\begin{align*}
\onslide<7->{-2(-26)-9 &= 17 - (-26)?} \\[6pt]
\onslide<8->{43 &= 43}
\end{align*}
\onslide<9->{\[x=-26\]}
\end{frame}

\begin{frame}{Example 1}
(c) \quad $\frac{1}{2}x + 3 = \frac{2}{5}x$
\begin{align*}
\onslide<2->{\frac{1}{2}x + 3 &= \frac{2}{5}x &} \\[8pt]
\onslide<3->{3 &= -\frac{1}{10}x &\text{subtract $\frac{1}{2}x$}} \\[8pt]
\onslide<4->{-30 &= x &\text{divide by $-\frac{1}{10}$}}
\end{align*}
\onslide<5->{Check $x=-30$:}
\begin{align*}
\onslide<6->{\frac{1}{2}(-30)+3 &= \frac{2}{5}(-30)?} \\[8pt]
\onslide<7->{-12 &= -12}
\end{align*}
\onslide<8->{\[x = -30\]}
\end{frame}

\begin{frame}{Example 1}
(d) \quad $2.1x - 7 = 23.83$
\begin{align*}
\onslide<2->{2.1x - 7 &= 23.83 &} \\[6pt]
\onslide<3->{2.1x &= 30.83 &\text{add 7}} \\[6pt]
\onslide<4->{x &\approx 14.68 &\text{divide by 2.1}}
\end{align*}
\onslide<5->{Check $x \approx 14.68$:}
\begin{align*}
\onslide<6->{2.1(14.68) - 7 &\approx 23.83?} \\[6pt]
\onslide<7->{23.828 &\approx 23.83}
\end{align*}
\onslide<8->{\[x \approx 23.83\]}
\end{frame}

\begin{frame}{Example 1}
(e) \quad $2(x-10) = 4(x-5)-2x$
\begin{align*}
\onslide<2->{2(x-10) &= 4(x-5)-2x &} \\[6pt]
\onslide<3->{2x-20 &= 4x-20 - 2x &\text{distribute}} \\[6pt]
\onslide<4->{2x-20 &= 2x-20 &\text{combine like terms on the right}} \\[6pt]
\onslide<5->{-20 &= -20 &\text{subtract $2x$ from both sides}}
\end{align*}
\onslide<6->{True statement, so $x = \text{all real numbers, or }\mathbb{R}$}
\end{frame}

\begin{frame}{Example 1}
(f) \quad $3(x+4)+3x = 2(3x+5)-2$
\begin{align*}
\onslide<2->{3(x+4)+3x &= 2(3x+5)-2 &} \\[6pt]
\onslide<3->{3x+12+3x &= 6x+10-2 &\text{distribute}} \\[6pt]
\onslide<4->{6x+12 &= 6x+8 &\text{combine like terms}} \\[6pt]
\onslide<5->{12 &= 8 &\text{subtract $6x$ from both sides}}
\end{align*}
\onslide<6->{False statement, so $x = \text{No solution, or } \varnothing$}
\end{frame}

\begin{frame}{Visual Way to Check Answers}
Another useful way to help check your answers is to graph the left side of the equation, as well as the right side. \newline\\	\pause

The solution is the $x$-coordinate of their \alert{intersection point}.	\newline\\	\pause

For ``no solution'' answers, the graphs will \textbf{never intersect}. \newline\\	\pause

For ``all real numbers'' answers, the graphs will be \textbf{one in the same}.
\end{frame}

\begin{frame}{Visual Way to Check Answers}
The graphs of $y = 3x+4$ and $y=16$ are shown below:	\newline\\
\begin{center}
\begin{tikzpicture}[scale=0.8]
    \begin{axis}
    [
    xlabel = $x$,
    ylabel = $y$,
    axis lines = middle,
    axis line style={stealth-stealth},
    axis line style={shorten >=-7.5pt, shorten <=-7.5pt},
    xmin = 0, xmax = 5,
    ymin = 0, ymax = 20,
    ystep = 4,
    xtick = {-4,-3,...,4},
    ytick = {4,8,...,20},
    grid,
    every axis x label/.style = {at = {(ticklabel* cs:1)}, anchor = south},
    every axis y label/.style = {at = {(ticklabel* cs:1)}, anchor = west}
    ]
    \addplot[domain = 0:4.5, samples = 200, line width = 1.5, smooth, color=blue]{3*x+4};
    \addplot[domain = 0:5, samples = 200, line width = 1.5, smooth, color=red] {16};
    \addplot [mark = *] coordinates {(4, 16)} node [below right] {\textbf{(4, 16)}};
    \end{axis}
    \end{tikzpicture}
\end{center}
\end{frame}

\section{Solve and graph inequalities on a number line.}

\begin{frame}{Solving Inequalities}
Solving inequalities is a lot like solving equations.	\newline\\	\pause

The biggest difference is that {\color{blue}\textbf{inequalities typically give you an infinite number of solutions.}}	\newline\\	\pause

For instance, there are an infinite number of values that you can substitute into $x$ for $x > -4$ to make it true.
\end{frame}

\begin{frame}{Visual Solutions to Inequalities}
Since we can't list every possible solution, we can shade a region on a number line to represent this solution.	\newline\\	\pause
\begin{center}
\begin{tikzpicture}
	\draw [<->, > = stealth] (-6,0) -- (-0,0);
	\foreach \x in {-5,-4,-3,-2,-1}
	\draw (\x, 0.1) -- (\x, -0.1);
	\foreach \x in {-5,-4,-3,-2,-1}
	\node at (\x, -0.3) {$\x$};
	\draw [->, color = blue, line width = 2.5, >=stealth] (-3.92,0) -- (-0.25,0);
	\draw [color = blue, fill=white] (-4,0) circle (3pt);
\end{tikzpicture}
\end{center}
\end{frame}

\begin{frame}{Summary of Graphing Inequalities}
If your variable is on the \alert{left side} when graphing an inequality, you can use the following table to help you graph:	\newline\\
\begin{center}
\setlength{\extrarowheight}{4pt}
\begin{tabular}{c|c|c}
\textbf{Expression}	&	\textbf{Circle}	&	\textbf{Shade}	\\
\hline
$x<$					&	Open				& 	Left		\\[4pt]
\hline
$x>$					&	Open				&	Right	\\[4pt]
\hline
$x \leq$				&	Closed			&	Left		\\[4pt]
\hline
$x \geq$				&	Closed			&	Right	\\[4pt]
\end{tabular}
\end{center}
\end{frame}

\begin{frame}{Example 2}
Graph each of the following on a number line.	\newline\\
\quad $x < 2$	\newline\\
\begin{center}
\onslide<2->{
	\begin{tikzpicture}
	\draw[<->] (-2,0) -- (2,0);
	\draw (0,0.15) -- (0,-0.15) node [below] {$2$};
	\onslide<3->{\draw[color=blue,fill=white] (0,0) circle [radius=3pt];}
	\onslide<4->{\draw[->,color=blue,ultra thick, shorten <= 3pt] (0,0) -- (-2,0);}
	\end{tikzpicture}
}
\end{center}
\end{frame}

\begin{frame}{Solving Inequalities}
With solving inequalities, you must remember to flip the inequality sign if you multiply or divide {\color{blue}\textbf{both sides}} by a \alert{negative number}.
\end{frame}

\begin{frame}{Example 3}
Solve and graph each.	\newline\\
(a) \quad $3x - 5 > -17$
\begin{align*}
\onslide<2->{3x-5 &> -17 &}	\\[6pt]
\onslide<3->{3x &> -12 &\text{add 5}} \\[6pt]
\onslide<4->{x &> -4 &\text{divide by 3}} \\[6pt]
\end{align*}
\begin{center}
\onslide<5->{
	\begin{tikzpicture}
	\draw[<->] (-2,0) -- (2,0);
	\draw (0,0.15) -- (0,-0.15) node [below] {$-4$};
	\onslide<6->{\draw[color=blue,fill=white] (0,0) circle [radius=3pt];}
	\onslide<7->{\draw[->,color=blue,ultra thick, shorten <= 3pt] (0,0) -- (2,0);}
	\end{tikzpicture}
}
\end{center}
\end{frame}

\begin{frame}{Example 3}
(b) \quad $2(x+4)-5 > 2x + 3$
\begin{align*}
\onslide<2->{2(x+4)-5 &> 2x+3 &} \\[6pt]
\onslide<3->{2x+8-5 &> 2x+3 &\text{distribute the 2}} \\[6pt]
\onslide<4->{2x+3 &> 2x + 3 &\text{combine like terms}} \\[6pt]
\onslide<5->{3 &> 3 &\text{subtract $2x$ from both sides}}
\end{align*}
\onslide<6->{False statement. \quad}
\onslide<7->{No Solution ($\varnothing$)}
\begin{center}
\onslide<8->{
	\begin{tikzpicture}
	\draw[<->] (-2,0) -- (2,0);
	\end{tikzpicture}
}
\end{center}
\end{frame}

\begin{frame}{Example 3}
(c) \quad $3(x+1) \geq 3x + 2$
\begin{align*}
\onslide<2->{3(x+1) &\geq 3x+2 &} \\[6pt]
\onslide<3->{3x+3 &\geq 3x+2 &\text{distribute}} \\[6pt]
\onslide<4->{3 &\geq 2 &\text{subtract $3x$ from both sides}}
\end{align*}
\onslide<5->{True statement. \quad}
\onslide<6->{All real numbers ($\mathbb{R}$)}
\begin{center}
\onslide<7->{
	\begin{tikzpicture}
	\draw[<->] (-2,0) -- (2,0);
	\onslide<8->{\draw[<->,color=blue,ultra thick] (-2,0) -- (2,0);}
	\end{tikzpicture}
}
\end{center}
\end{frame}

\end{document}


\documentclass[8pt]{article}

\usepackage{fullpage}
\usepackage[margin=.7in]{geometry}
\usepackage{epic}
\usepackage{eepic}
\usepackage{graphicx}
\usepackage{mathtools}
\usepackage{algorithm}
\usepackage[noend]{algpseudocode}
\usepackage{ragged2e}
\usepackage[parfill]{parskip}
\usepackage{amsmath}
\usepackage{amssymb}

\newcommand{\proof}[1]{
{\noindent {\it Proof.} {#1} \rule{2mm}{2mm} \vskip \belowdisplayskip}
}

\DeclarePairedDelimiter\ceil{\lceil}{\rceil}
\DeclarePairedDelimiter\floor{\lfloor}{\rfloor}

\newtheorem{lemma}{Lemma}[section]
\newtheorem{theorem}[lemma]{Theorem}
\newtheorem{claim}[lemma]{Claim}
\newtheorem{definition}[lemma]{Definition}
\newtheorem{corollary}[lemma]{Corollary}

\begin{document}
\hfill \small{\today} \\
\setlength{\fboxrule}{.5mm}\setlength{\fboxsep}{1.2mm}
\newlength{\boxlength}\setlength{\boxlength}{\textwidth}
\addtolength{\boxlength}{-4mm}
\begin{center}\framebox{\parbox{\boxlength}{\bf
\center{CS 577 - Homework 5}
\center{Sejal Chauhan, Vinothkumar Siddharth, Mihir Shete}
}}\end{center}
\vspace{5mm}

\section{Graded written problem}

\textbf{Input:} In a city there are $n$ bus drivers. There are also $n$ morning bus routes and $n$ afternoon bus routes, each with various lengths. Each driver is assigned one morning route
and one evening route. For any driver, if his total route length for a day exceeds $d$, he has to
be paid overtime for every hour after the first $d$ hours at a fixed rate per hour.
\\ \\
\textbf{Output:} Assign one morning route and one evening route to each bus driver so that the total overtime amount that the city authority has to pay is minimized.

\subsection{Algorithm}
Our greedy algorithm begins by sorting the $n$ morning bus routes in reverse order (Longest route first) and the $n$ afternoon bus routes in order. To find a set $G\{(m,a): \forall m \in M \land \forall a \in A \}$, where M is set of all morning routes and A is the set of all evening routes, we will use the following \textit{strategy}:
\begin{enumerate}
    \item Starting from the first morning(largest) route we get the smallest available afternoon route and pair them.
\end{enumerate}

\begin{algorithm}
\caption{Pseudocode of our greedy strategy}\label{euclid}
\begin{algorithmic}[1]
\Procedure{Find-All-Pairs}{$M$, $A$}

\State $i \leftarrow 0$

\While{$i \textless \left\vert{M}\right\vert$}
        \State Pair $M[i]$, $A[i]$
        \State $i \leftarrow i + 1$
\EndWhile
\EndProcedure
\end{algorithmic}
\end{algorithm}

\subsection{Exchange Argument}
Let $r$ be all the route-pairs in a solution that are greater than $d$ and let $l_i$ be the length of the route-pair . $p(G) = \sum_{r}(l_i - d)$ for our greedy solution $G$, similarly for an optimal Solution $S$ $p(S) = \sum_{r}(l_i - d)$

If, $G = S$ then clearly $p(G) = p(S)$.

Otherwise, $G \neq S$. So, there must be some 2 routes in $G$ and $S$, such that the morning routes are the same but the paired afternoon routes are different. More formally, if ($M_G(i)$, $A_G(i)$), ($M_G(j)$, $A_G(j)$) are 2 pairs in G and ($M_S(k)$, $A_S(k)$), ($M_S(l)$, $A_S(l)$) are 2 pairs in S, then
$$M_G(i) = M_S(k) \And M_G(j) = M_S(l)$$
but,
$$A_G(i) \neq A_S(k) \And A_G(j) \neq A_S(l)$$ \\
Let, $M_{ik} = M_G(i) = M_S(k)$ and $M_{jl} = M_G(j) = M_S(l)$
Now, consider the following scenarios in $S$:
\begin{description}
    \item[$M_{ik} \textgreater M_{jl}$] \hfill \\
        Let $S'$ denote a solution which would have selected the ($M_{ik}, A_S(l)$) and ($M_{jl}, A_S(k)$) pair contrary to $S$. $S'$ is similar to $G$ in a way that $G$ would also have chosen the same pairing as $S'$. So, given the constraint on morning routes $S'$ will choose the afternoon route first for $M_{ik}$ and it will pair with $A_S(l)$ if:

    \begin{enumerate}
        \item \textbf{$A_S(l) \textless A_S(k)$ and $M_{ik} + A_S(l) \leq d$} \hfill \\
            For the above constraints $M_{jl} + A_S(k)$ can be less than, more than or equal to $d$, so lets analyze all the conditions:
            Here, if $$M_{jl} + A_S(k) \textgreater d$$ it follows that $$M_{ik} + A_S(k) \textgreater d$$ But, $$p(S') = C + M_{jl} + A_S(k) - d$$
            $$p(S) = C + M_{ik} + A_S(k) - d$$ $\because M_{jl} \textless M_{ik}$ it implies that $p(S') \textless p(S)$ \\ \\
            $M_{jl} + A_S(k) \leq d$ then the overtime introduced by the swap is $0$ and so $p(S') \leq p(S) $ \\ \\

        \item \textbf{$A_S(l) \textless A_S(k)$ and $M_{ik} + A_S(l) \textgreater d$} \hfill \\
            For the above constraints $M_{jl} + A_S(k)$ can be less than, more than or equal to $d$, so lets analyze all the conditions:
            Here, if $M_{jl} + A_S(k) \textgreater d$ and $M_{jl} + A_S(l) \textgreater d$ it is trivial to see that $p(S') = p(S)$ since the extra hours introduced for both the selections will be $M_{ik} + M_{jl} + A_S(k) + A_S(l) - 2$. \\ \\
            But if $M_{jl} + A_S(k) \textgreater d$ and $M_{jl} + A_S(l) \leq d$
            $$p(S) = M_{ik} + A_S(k) - d$$
            $$p(S') = M_{ik} + A_S(l) + M_{jl} + A_S(k) - 2d = p(S) + M_{jl} + A_S(l) - d \leq p(S) \because M_{jl} + A_S(l) \leq d$$\\

            If, $M_{jl} + A_S(k) \leq d$ then it implies that $M_{jl} + A_S(l) \leq d$ from the constraints. $$p(S') =  C + M_{ik} + A_S(l) - d$$ And $$p(S) = C + M_{ik} + A_S(k) - d$$
            And since $A_S(l) \textless A_S(k)$ it is clear that $p(S') \textless p(S)$
    \end{enumerate}
\end{description}

From the above analysis it is clear that $p(S') \leq p(S)$ whenever the order is changed according to greedy strategy. Hence, our greedy strategy will provide an optimal solution.

\subsection{Running Time Analysis}
To sort get the routes in correct order for our greedy algorithm to process we will have to spend $O(n\log{n})$ time. The \textbf{Find-All-Pairs} procedure will iterate over all $n$ elements in $M$ and all the operations in these iterations are constant time. So overall runtime is:

$$O(n \log{n} + c*n) = O(n \log{n})$$

\end{document}


% This is a comment, this will be not be read by the machine

% Which type of document do you want?
\documentclass[a4paper,12pt]{article}

% Use packages for different functioanlities
\usepackage[utf8]{inputenc} % For character encoding
\usepackage{natbib} % For bibliography
\usepackage{amsmath} % For mathematics
\usepackage{amssymb}
\usepackage{graphicx} % For graphics
\usepackage{url} % For including web links
\usepackage{tikz} % For advanced graphics with the language TikZ
\usepackage[font=footnotesize]{caption}
\linespread{1.33} % Control spread between lines
\usepackage[toc,page]{appendix}
\usepackage[colorlinks=true,linkcolor=red,urlcolor=red,citecolor=blue,backref=page]{hyperref}
\usepackage{rotating}
\usepackage{amsthm}
% \usepackage[top=2.5cm, bottom=2.5cm, left=3cm, right=3cm]{geometry}

% Now comes the main part
\title{Introduction to \LaTeX\\
\scriptsize{Put subtitle here}} %This sets up the title, note the `\\' command for a newline
%\title{new title}
\author{Abhinav Anand}
%\thanks{Herein goes thanks.}

\date{} %If you comment this out, the date will be displayed

\begin{document}

\maketitle %This command "makes" the title

\begin{abstract}

Ha ha ha what a funny abstract!

\end{abstract}

\section{What a funny section!}
\label{Funny_Label}

\LaTeX uses a ``markup language'' in order to convert text, combined with the markup, into a high quality document. For example, web pages work in a similar way: the HTML
(Hyper Text Markup Language) is used to style the text document, and the browser presents it in its full glory --- with different colors, fonts, sizes, etc.
%\\\\\\
Each of the \LaTeX commands begin with a backslash. This is \LaTeX's way of knowing that whenever it sees a backslash, to expect some commands. Comments are not classed as a commands.

You can force a new line using \\
%To force a new page, use \newpage or \clearpage

this is the ``right'' way

this is the ''wrong'' way

\section*{The section with no number}

That's how you do it --- with a star!

\subsection{Subsection}

Here is my subsection

In order to have a subsection without a name, just use the old trick --- attach
a star to the end of the command: %\subsection*{}

\subsubsection{This is my subsubsection}

Again, use the star in the relevant command to omit natural numbering of sections.

Now let us introduce equations, since that's what we're here to learn!

\section{Support for Mathematics}

You can generate equations via the following ``environment'' --- the
equation environment enclosed in the ``begin'' and ``end'' equations:
% (Note the biggest mistake made in latex when enclosing quotes: `` vs '')$ \dfrac{num}{den} $

\begin{equation}
\label{Eq:Number_1}
\int_{0}^{\infty} e^{-\rho} \rho^{2l}\left[ L_{n+l}^{2l+1} \left(\rho
\right) \right]^2 \rho^2 d\rho = \frac{2n \left[\left(n+l\right)!
	\right]^3}{(n-l-1)!}
\end{equation}

$\displaystyle\sum_{i=0}^{i=\infty}f^2$

Needless to say you can generate any equation of any arbitrary complexity and it is
guaranteed to be rendered beautifully.

If you don't want the equation numbers you can use a star after the word
``equation'' above. TeXstudio prompts you anyway regarding that.

Yet another way to generate anonymous equations is the following operator: %\[\]

\[
\bar{N}_j^g = \frac{\sum\limits_{k} N_{jk} W_k}{\sum\limits_{K} W_k}
\]

You can also use equations inline by using the dollar signs and squeezing all
mathematics within them. For example, $\nexists$ a markup/typesetting language
better than \LaTeX  and it's as easy to see as $x^2 + x_1 + x = g(\cdot)$.\footnote{Let's add a footnote for fun!}

\subsection{Subequations}

Let's now add subequations to complete the discussion

\begin{subequations}
	\begin{equation}
	e^{i\pi} + 1 = 0
	\label{1a}
	\end{equation}
	\begin{equation}
	\nabla \times \mathbf{H} = \frac{\varepsilon}{c} \frac{\partial \mathbf{E}}{\partial{t}}
	\label{1b}
	\end{equation}
	\label{1}
\end{subequations}

More mathematics:

$\sqrt[3]{5}$

$\frac{x}{y}$

$\dfrac{\displaystyle\int_{0}^{\infty}fg d\mu}{\frac{\varepsilon}{c}}$

$A^{x} {y}$

$\sum {k=1}^n k$

$2 \ne 4$

$\phi \in \Psi$

$\hat{\i} \times \hat{\j} = \hat{k}$

$f^{\prime}(\xi)$

180$^{\circ}$C

\section{Figures}

To include figures in a document the package graphicx is required, so the command
%\usepackage{graphicx}
must be written in the preamble. To add a figure one can
write the following commands.

 \begin{figure}[h!tbp] % htbp
 	\centering
 	\includegraphics[width=12cm,height=6cm]{Boxplot_Integration.pdf}
 	%\includegraphics[width=0.5\textwidth]{Boxplot_Integration.pdf}
 	\caption{Add fancy captions here}
 	\label{Fig:Label_Boxplot}
 \end{figure}

In general we wish to add labels to figures, sections, tables etc. since it is very
handy to be able to refer to them as and when needed using the backslash ref command.
You can use labels to refer to the section maybe a hundred pages later
by using it to go back to section \ref{Funny_Label}.

[h!] is an option of the figure environment. This tells \LaTeX to put this image in
the next available space. Therefore if the image does not fit where it was written in
the .tex document, \LaTeX will move the float to the next page and shift some text on top of
it to minimise empty spaces.

Another example:

 \begin{figure}[h!tbp] % htbp
 	\centering
 	%\includegraphics[width=12cm,height=6cm]{Boxplot_Integration.pdf}
 	\includegraphics[width=0.9\textwidth]{Banking_Sector_US.pdf}
 	\caption{Add fancy captions here}
 	\label{Fig:Cum_fraction_eigen_US}
 \end{figure}

 \section{Typeface Styles}

 Have a look!

 \subsection{Typeface}

 \emph{Text}, \textbf{Text}, \texttt{Text}, \textrm{Text},
 \textsf{Text}, \textsc{Text}, \textit{Text}

 \subsection{Size}

 {\tiny Text}, {\scriptsize Text}, {\footnotesize Text},
 {\small Text}, {\normalsize Text}, {\large Text}, {\Large
 	Text}, {\LARGE Text}, {\huge Text}, {\Huge Text}

 \subsection{Alignment}

 \begin{center} %/flushright/flushleft
 	put things here for fun
 \end{center} %/flushright/flushleft

\section{Lists}

There are two main types of lists that are popular --- bullet points and numbered lists

Here is how you use the bullet points:

\begin{itemize}
	\item this is one item
	\item this is another item
\end{itemize}

To generate numbered lists:

%\ref{Fig:Label_Boxplot}

\begin{enumerate}
	\item this is one item
	\item this is another item
\end{enumerate}

also, you can use whatever symbol you wish!

\begin{itemize}
	\item[$\diamond$] this is one item
	\item[$\diamond$] this is another item
\end{itemize}

\section{Tables}

\begin{table}
	\centering
	\caption{Several types of tables can be accommodated}
	\label{Table:Systemic_Banks}
	\scriptsize{
		\begin{tabular}{llc} % Why lll? What about ccc or rrr or some combination?
			\hline
			&\textbf{G-SIB}			&\textbf{D-SIB} 		\\   \hline
			&Bank of America			&BB\&T					\\
			&JP Morgan Chase			&Comerica				\\
			&Wells Fargo				&Huntington Bancshares	\\
			&State Street				&M\&T Bank				\\
			&Morgan Stanley				&PNC					\\
			&Goldman Sachs				&Regions				\\
			&Bank of New York Mellon	&Zions					\\
			&Citigroup					&Fifth Third			\\
			&							&SunTrust				\\
			&							&US Bancorp				\\
			&							&KeyCorp				\\\hline
		\end{tabular}
	}
\end{table}

Let's try some more tables:

\begin{table}[ht]
	\centering
	\begin{tabular}{|r||c|c|} \hline
		Trial & $n$ & $t$ \\ \hline
		1 & 23 & 2 \\ \hline
		2 & 15 & 10 \\ \hline
		3 & 100 & 20 \\ \hline
	\end{tabular}
\end{table}

\section{References}

Finally let's see how to build bibliography:

My hero Sergiu Hart: \cite{FH:2009}

Other types of citation include \citep{FRB:2003}, \cite{Brownlees_Engle:2015},
\cite{Haas:2009}, \cite{Rachev:2005b}, \nocite{Fahlenbrach_et_al:2016} etc.

\bibliographystyle{StyWorking_Paper}% Select the citation style e.g. ieeetr
\bibliography{Introduction_to_Bibliography_Dublin_Reading_Group_20170615}% use the .bib file

\end{document}


\begin{figure*}
%\vspace{-1em}
\centering
%\includegraphics[width=0.99\linewidth, trim={10cm 0 0 0},clip]{../yellowfin_iclr2018/manuscript_for_revision/experiment_results/resnet/mom_dynamic_3_annotated.pdf}
\includegraphics[width=0.99\linewidth]{../yellowfin_iclr2018/manuscript_for_revision/experiment_results/resnet/mom_dynamic_3_annotated.pdf}
	\vspace{-0.5em}
	\caption{
	When running \tuner, total momentum $\hat{\mu}_t$ equals algorithmic value in synchronous settings (left); $\hat{\mu}_t$ is greater than algorithmic value on 16 asynchronous workers (middle).
	\Asynctuner automatically lowers algorithmic momentum and brings total momentum to match the target value (right).
%Red dots are measured $\hat{\mu}_t$ at every step with red line as its running average.
	Red dots are total momentum estimates, $\hat{\mu}_T$, at each iteration.
The solid red line is a running average of $\hat{\mu}_T$.
%	When running \tuner, total momentum $\hat{\mu}_t$ is greater than algorithmic value on 16 asynchronous workers (left).
%	\Asynctuner automatically lowers algorithmic momentum and matches total momentum to the target value (right).
%%Red dots are measured $\hat{\mu}_t$ at every step with red line as its running average.
%	Red dots are total momentum estimates, $\hat{\mu}_T$, at each iteration.
%    The solid red line is a running average of $\hat{\mu}_T$.
	}
	\label{fig:we-can-measure}
%\vspace{-0.35em}
\end{figure*}

\section{\Asynctuner}
\label{sec:async_tuner}

Asynchrony is a parallelization technique that avoids synchronization barriers \citep{recht2011hogwild}.
In this section, we propose a {\em closed momentum loop} variant of \tuner to accelerate convergence in asynchronous training.
%To handle the momentum dynamics of asynchronous parallelism, we propose a {\em closed momentum loop} variant of \tuner.
After some preliminaries, we show the mechanism of the extension:
it measures the dynamics on a running system and controls momentum with a negative feedback loop.
\paragraph{Preliminaries}
%Asynchrony is a popular parallelization technique \citep{recht2011hogwild} that avoids synchronization barriers.
When training on $M$ asynchronous workers, staleness (the number of model updates between a worker's read and write operations) is on average $\tau=M-1$,
i.e., the gradient in the SGD update is delayed by $\tau$ iterations as $\nabla f_{S_{t - \tau}}(x_{t - \tau} )$.
Asynchrony yields faster steps, but can
increase the number of iterations to achieve the same solution,
a tradeoff between hardware and statistical
efficiency~\citep{DBLP:journals/pvldb/ZhangR14}.
\citet{mitliagkas2016asynchrony} interpret asynchrony as added momentum dynamics.
Experiments in \citet{hadjis2016omnivore} support this finding, and demonstrate that reducing algorithmic momentum can compensate for asynchrony-induced momentum
and significantly reduce the number of iterations for convergence.
Motivated by that result, we use the model
in~\eqref{equ:exp_async_update_app}, where the total momentum, $\mu_T$, includes both asynchrony-induced and algorithmic  momentum, $\mu$, in~\eqref{eqn:momentum_gd}.
\begin{equation}
	\mathbb{E}[ x_{t+1} - x_t ]
	= \mu_T \mathbb{E}[x_t - x_{t-1}] - \alpha \mathbb{E}\nabla f(x_{t})
\label{equ:exp_async_update_app}
\end{equation}
We will use this expression to design an estimator for the value of total momentum, $\hat{\mu}_T$.
This estimator is a basic building block of \asynctuner, that {\em removes the need to manually compensate for the effects of asynchrony}.

\paragraph{Measuring the momentum dynamics}
\Asynctuner estimates total momentum $\mu_{T}$ on a running system and uses a negative feedback loop to adjust algorithmic momentum accordingly.
Equation~\eqref{equ:exp_async_update} gives an estimate of $\hat{\mu}_T$ on a system with staleness $\tau$, based on \eqref{equ:exp_async_update}.
\begin{align}
\hat{\mu}_T
					= \mathop{\mathsf{median}}\left(
							\frac{x_{t - \tau} - x_{t - \tau-1} + \alpha \nabla_{S_{t-\tau -1}} f(x_{t - \tau - 1} )}
							{x_{t - \tau-1} - x_{t - \tau-2}}
					\right)
\label{eqn:momentum_measurement}
\end{align}
We use $\tau$-stale model values to match the staleness of the gradient,  and perform all operations in an elementwise fashion.
This way we get a total momentum measurement from each variable;
the median combines them into a more robust estimate.

\paragraph{Closing the asynchrony loop}
Given a reliable measurement of $\mu_{T}$,
we can use it to adjust the value of algorithmic momentum so that the total momentum matches the \emph{target momentum} as decided by \tuner in Algorithm~\ref{alg:basic-algo}.
\Asynctuner in Algorithm~\ref{alg:async-algo} %(in Appendix~\ref{sec:async_yf})
uses a simple negative feedback loop to achieve the adjustment.
%Figure~\ref{fig:we-can-measure} demonstrates that under asynchrony the measured total momentum is strictly higher than the algorithmic momentum (middle plot), as expected from theory;
%closing the feedback loop (right plot) leads to total momentum matching the target momentum.
%Closing the loop, as we will see, improves performance significantly.
%Note for asynchronous-parallel training, as the estimates and parameter tuning is unstable in the beginning when there are only a small number of iterations, we use initial learning $\frac{1}{\tau + 1}$ instead of $1.0$ to prevent overflow in the beginning.

%\begin{algorithm}[H]
%	\caption{\Asynctuner}
%	\begin{algorithmic}[1]
%%	\State Input: $\mu\gets0$, $\alpha \gets \frac{1}{\tau + 1}$, $\gamma\gets0.01, \tau$ (staleness)
%	\State Input: $\mu\gets0$, $\alpha \gets 0.0001$, $\gamma\gets0.01, \tau$ (staleness)
%	\For { $t\gets1$ to $T$}
%	\State $x_t\!\gets\!x_{t - 1} + \mu (x_{t - 1} - x_{t - 2} ) - \alpha \nabla_{S_t} f(x_{t - \tau - 1} )$
%	\State $\mu^*,\alpha \gets \Call{\tuner}{\nabla_{S_t} f(x_{t - \tau - 1} ), \beta}$ %(get momentum from the dynamic range)
%	\State $\hat{\mu_T}
%					\gets \mathop{\mathsf{median}}\left(
%							\frac{x_{t - \tau} - x_{t - \tau-1} + \alpha \nabla_{S_{t-\tau-1}} f(x_{t - \tau - 1} )}
%							{x_{t - \tau-1} - x_{t - \tau-2}}
%					\right)$ \Comment{Measuring total momentum}
%	\State $\mu \leftarrow \mu + \gamma \cdot (\mu^* - \hat{\mu_T})$ \Comment{Closing the loop}
%	\EndFor
%\end{algorithmic}
%\label{alg:async-algo}
%\end{algorithm}

%In Section~\ref{sec:async_tuner}, we briefly discuss the mechanism of our designed \Asynctuner in asynchronous-parallel setting. In this appendix, we expand the details in total momentum estimator, $\hat{\mu_T}$, and present the full \Asynctuner in Algorithm~\ref{alg:async-algo} with extensive discussion.
%\paragraph{Measuring the momentum dynamics}
%Remember, we use the formula in~\eqref{equ:exp_async_update_app} to model the momentum dynamics in asynchronous-parallel systems
%\Asynctuner estimates total momentum $\mu_{T}$ on a running system and uses a negative feedback loop to adjust algorithmic momentum accordingly.
%\begin{equation}
%	\mathbb{E}[ x_{t+1} - x_t ]
%	= \mu_T \mathbb{E}[x_t - x_{t-1}] - \alpha \mathbb{E}\nabla f(x_{t})
%\label{equ:exp_async_update_app}
%\end{equation}
%Equation~\eqref{eqn:momentum_measurement_app} gives an estimate of $\hat{\mu_T}$ on a system with staleness $\tau$, based on \eqref{equ:exp_async_update_app}.
%\begin{align}
%\hat{\mu_T}
%					= \mathop{\mathsf{median}}\left(
%							\frac{x_{t - \tau} - x_{t - \tau-1} + \alpha \nabla_{S_{t-\tau -1}} f(x_{t - \tau - 1} )}
%							{x_{t - \tau-1} - x_{t - \tau-2}}
%					\right)
%\label{eqn:momentum_measurement_app}
%\end{align}
%We use $\tau$-stale model values to match the staleness of the gradient,  and perform all operations in an elementwise fashion.
%This way we get a total momentum measurement from each variable;
%the median combines them into a more robust estimate.
%
%%\label{subsec:closed_loop_YF}
%%\begin{figure}
%%\centering
%%\includegraphics[width=0.95\linewidth]{experiment_results/resnet/mom_dynamic_3_annotated.pdf}
%%	\caption{
%%	Momentum dynamics on CIFAR100 ResNet.
%%	Running \tuner, total momentum is equal to algorithmic momentum in a synchronous setting (left). Total momentum is greater than algorithmic momentum on 16 asynchronous workers, due to asynchrony-induced momentum (middle).
%%	Using the momentum feedback mechanism of \asynctuner, lowers algorithmic momentum and brings total momentum to match the target value on 16 asynchronous workers (right).
%%	Red dots are individual total momentum estimates, $\hat{\mu}_T$, at each iteration.
%%The solid red line is a running average of those estimates.
%%	}
%%	\label{fig:we-can-measure}
%%\end{figure}
%
%\paragraph{Closing the asynchrony loop}
%Given a reliable measurement of $\mu_{T}$,
%we can use it to adjust the value of algorithmic momentum so that the total momentum matches the \emph{target momentum} as decided by \tuner in Algorithm~\ref{alg:basic-algo}.
%\Asynctuner in Algorithm~\ref{alg:async-algo} %(in Appendix~\ref{sec:async_yf})
%uses a simple negative feedback loop to achieve the adjustment.
%%Figure~\ref{fig:we-can-measure} demonstrates that under asynchrony the measured total momentum is strictly higher than the algorithmic momentum (middle plot), as expected from theory;
%%closing the feedback loop (right plot) leads to total momentum matching the target momentum.
%%Closing the loop, as we will see, improves performance significantly.
%%%Note for asynchronous-parallel training, as the estimates and parameter tuning is unstable in the beginning when there are only a small number of iterations, we use initial learning $\frac{1}{\tau + 1}$ instead of $1.0$ to prevent overflow in the beginning.
%%
%%%\begin{algorithm}[H]
%%%	\caption{\Asynctuner}
%%%	\begin{algorithmic}[1]
%%%%	\State Input: $\mu\gets0$, $\alpha \gets \frac{1}{\tau + 1}$, $\gamma\gets0.01, \tau$ (staleness)
%%%	\State Input: $\mu\gets0$, $\alpha \gets 0.0001$, $\gamma\gets0.01, \tau$ (staleness)
%%%	\For { $t\gets1$ to $T$}
%%%	\State $x_t\!\gets\!x_{t - 1} + \mu (x_{t - 1} - x_{t - 2} ) - \alpha \nabla_{S_t} f(x_{t - \tau - 1} )$
%%%	\State $\mu^*,\alpha \gets \Call{\tuner}{\nabla_{S_t} f(x_{t - \tau - 1} ), \beta}$ %(get momentum from the dynamic range)
%%%	\State $\hat{\mu_T}
%%%					\gets \mathop{\mathsf{median}}\left(
%%%							\frac{x_{t - \tau} - x_{t - \tau-1} + \alpha \nabla_{S_{t-\tau-1}} f(x_{t - \tau - 1} )}
%%%							{x_{t - \tau-1} - x_{t - \tau-2}}
%%%					\right)$ \Comment{Measuring total momentum}
%%%	\State $\mu \leftarrow \mu + \gamma \cdot (\mu^* - \hat{\mu_T})$ \Comment{Closing the loop}
%%%	\EndFor
%%%\end{algorithmic}
%%%\label{alg:async-algo}
%%%\end{algorithm}
%%
%
%
%

\begin{algorithm}[h]
	\caption{\Asynctuner}
	\begin{algorithmic}[1]
%	\State Input: $\mu\gets0$, $\alpha \gets \frac{1}{\tau + 1}$, $\gamma\gets0.01, \tau$ (staleness)
	\State Input: $\mu\gets0$, $\alpha \gets 0.0001$, $\gamma\gets0.01, \tau$ (staleness)
	\For { $t\gets1$ to $T$}
	\State $x_t\!\gets\!x_{t - 1} + \mu (x_{t - 1} - x_{t - 2} ) - \alpha \nabla_{S_t} f(x_{t - \tau - 1} )$
	\State $\mu^*,\alpha \gets \Call{\tuner}{\nabla_{S_t} f(x_{t - \tau - 1} ), \beta}$ %(get momentum from the dynamic range)
	\State $\hat{\mu_T}
					\gets \mathop{\mathsf{median}}\left(
							\frac{x_{t - \tau} - x_{t - \tau-1} + \alpha \nabla_{S_{t-\tau-1}} f(x_{t - \tau - 1} )}
							{x_{t - \tau-1} - x_{t - \tau-2}}
					\right)$ \Comment{Measuring total momentum}
	\State $\mu \leftarrow \mu + \gamma \cdot (\mu^* - \hat{\mu_T})$ \Comment{Closing the loop}
	\EndFor
\end{algorithmic}
\label{alg:async-algo}
\end{algorithm}

%%%%%%%%%%%%%%%%% latest backup version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Asynchrony is a parallelization technique that avoids synchronization barriers \citep{recht2011hogwild}.
%%In this section, we propose a {\em closed momentum loop} variant of \tuner to accelerate convergence in asynchronous training.
%%To handle the momentum dynamics of asynchronous parallelism, we propose a {\em closed momentum loop} variant of \tuner.
%%After some preliminaries, we show the mechanism of the extension:
%%it measures the dynamics on a running system and controls momentum with a negative feedback loop.
%%\paragraph{Preliminaries}
%%Asynchrony is a popular parallelization technique \citep{recht2011hogwild} that avoids synchronization barriers.
%%When training on $M$ asynchronous workers, staleness (the number of model updates between a worker's read and write operations) is on average $\tau=M-1$,
%%i.e., the gradient in the SGD update is delayed by $\tau$ iterations as $\nabla f_{S_{t - \tau}}(x_{t - \tau} )$.
%%It yields faster steps, but can
%%increase the number of iterations needed,
%%a tradeoff between hardware and statistical
%%efficiency~\citep{DBLP:journals/pvldb/ZhangR14}.
%It yields better hardware efficiency, i.e. faster steps, but can
%increase the number of iterations to a given metric, i.e. statistical efficiency, as a tradeoff~\citep{DBLP:journals/pvldb/ZhangR14}.
%%a tradeoff between hardware and statistical
%%efficiency~\citep{DBLP:journals/pvldb/ZhangR14}.
%%In this section, we propose a {\em closed momentum loop} variant of \tuner to reduce the number of iterations it needs to converge in asynchronous training.
%%In this section, we propose a {\em closed momentum loop} variant of \tuner to reduce the number of iterations for convergence in asynchronous training.
%%\paragraph{\Asynctuner}
%\citet{mitliagkas2016asynchrony} interpret asynchrony as added momentum dynamics.
%%It is empirically supported in \citet{hadjis2016omnivore} that manually reducing algorithmic momentum can compensate for asynchrony-induced momentum
%%and significantly reduce the number of iterations to converge.
%We design \asynctuner, a variant of \tuner to automatically control algorithmic momentum, compensate for asynchrony and accelerate convergence.
%We use the formula in~\eqref{equ:exp_async_update} to model the dynamics in the system, where the total momentum, $\mu_T$, includes both asynchrony-induced and algorithmic  momentum, $\mu$, in~\eqref{eqn:momentum_gd}.
%\begin{equation}
%	\mathbb{E}[ x_{t+1} - x_t ]
%	= \mu_T \mathbb{E}[x_t - x_{t-1}] - \alpha \mathbb{E}\nabla f(x_{t})
%\label{equ:exp_async_update}
%\end{equation}
%We first use~\eqref{equ:exp_async_update} to design an robust estimator $\hat{\mu}_T$ for the value of total momentum at every iteration.
%%This estimator is a basic building block of \asynctuner, that {\em removes the need to manually compensate for the effects of asynchrony}.
%Then we use a simple negative feedback control loop to adjust the value of algorithmic momentum so that $\hat{\mu}_T$ matches the \emph{target momentum} decided by \tuner in Algorithm~\ref{alg:basic-algo}.
%%We refer to Appendix~\ref{sec:async_app} for details on estimator $\hat{\mu}_T$ and \Asynctuner in Algorithm~\ref{alg:async-algo}.
%%\Asynctuner in Algorithm~\ref{alg:async-algo} (in Appendix~\ref{sec:async_app}) %(in Appendix~\ref{sec:async_yf})
%%uses a simple negative feedback loop to achieve the adjustment.
%In Figure~\ref{fig:we-can-measure},
%we demonstrate momentum dynamics in an asynchronous training system.
%As directly using the target value as algorithmic momentum, \tuner (middle) presents total momentum $\hat{\mu}_T$ strictly larger than the target momentum, due to asynchrony-induced momentum. \Asynctuner (right) automatically brings down algorithmic momentum, match measured total momentum $\hat{\mu}_T$ to target value and, as we will see, speeds up convergence comparing to \tuner. We refer to Appendix~\ref{sec:async_app} for details on estimator $\hat{\mu}_T$ and \Asynctuner in Algorithm~\ref{alg:async-algo}.
%%
%%so that visually demonstrates the mechanism of \Asynctuner in handling the momentum dynamics under asynchrony. In asynchronous-parallel setting, the measured total momentum is strictly higher than the algorithmic momentum (middle plot), as expected from theory.
%%Closing the feedback loop (right plot) leads to total momentum matching the target momentum and, as we will see, improves performance significantly.
%
%%\begin{figure*}
%%%\vspace{-2.5em}
%%\centering
%%\includegraphics[width=\linewidth]{experiment_results/resnet/mom_dynamic_3_annotated.pdf}
%%	\caption{
%%	When running \tuner, total momentum $\hat{\mu}_t$ equals algorithmic value in synchronous settings (left); $\hat{\mu}_t$ is greater than algorithmic value on 16 asynchronous workers (middle).
%%	\Asynctuner automatically lowers algorithmic momentum and brings total momentum to match the target value (right).
%%Red dots are measured $\hat{\mu}_t$ at every step with red line as its running average.
%%%	Red dots are total momentum estimates, $\hat{\mu}_T$, at each iteration.
%%%The solid red line is a running average of $\hat{\mu}_T$.
%%	}
%%	\vspace{-0.25em}
%%	\label{fig:we-can-measure}
%%\end{figure*}

%%%%%%%%%%%%%%%%%%%%%% latest backup versions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%\begin{figure}
%%\centering
%%\includegraphics[width=0.95\linewidth]{experiment_results/resnet/mom_dynamic_3_annotated.pdf}
%%	\caption{
%%%	Momentum dynamics on CIFAR100 ResNet.
%%	Running \tuner on a ResNet, total momentum equals algorithmic value in a synchronous setting (left). Total momentum is greater than algorithmic value on 16 asynchronous workers, due to asynchrony-induced momentum (middle).
%%	\asynctuner automatically lowers algorithmic momentum and brings total momentum to match the target value (right).
%%	Red dots are total momentum estimates, $\hat{\mu}_T$, at each iteration.
%%The solid red line is a running average of $\hat{\mu}_T$.
%%	}
%%	\label{fig:we-can-measure}
%%\end{figure}
%Asynchrony is a parallelization technique that avoids synchronization barriers \citep{recht2011hogwild}.
%%In this section, we propose a {\em closed momentum loop} variant of \tuner to accelerate convergence in asynchronous training.
%%To handle the momentum dynamics of asynchronous parallelism, we propose a {\em closed momentum loop} variant of \tuner.
%%After some preliminaries, we show the mechanism of the extension:
%%it measures the dynamics on a running system and controls momentum with a negative feedback loop.
%%\paragraph{Preliminaries}
%%Asynchrony is a popular parallelization technique \citep{recht2011hogwild} that avoids synchronization barriers.
%%When training on $M$ asynchronous workers, staleness (the number of model updates between a worker's read and write operations) is on average $\tau=M-1$,
%%i.e., the gradient in the SGD update is delayed by $\tau$ iterations as $\nabla f_{S_{t - \tau}}(x_{t - \tau} )$.
%%It yields faster steps, but can
%%increase the number of iterations needed,
%%a tradeoff between hardware and statistical
%%efficiency~\citep{DBLP:journals/pvldb/ZhangR14}.
%It yields better hardware efficiency, i.e. faster steps, but can
%increase the number of iterations to a given metric, i.e. statistical efficiency, as a tradeoff~\citep{DBLP:journals/pvldb/ZhangR14}.
%%a tradeoff between hardware and statistical
%%efficiency~\citep{DBLP:journals/pvldb/ZhangR14}.
%%In this section, we propose a {\em closed momentum loop} variant of \tuner to reduce the number of iterations it needs to converge in asynchronous training.
%%In this section, we propose a {\em closed momentum loop} variant of \tuner to reduce the number of iterations for convergence in asynchronous training.
%%\paragraph{\Asynctuner}
%\citet{mitliagkas2016asynchrony} interpret asynchrony as added momentum dynamics.
%%It is empirically supported in \citet{hadjis2016omnivore} that manually reducing algorithmic momentum can compensate for asynchrony-induced momentum
%%and significantly reduce the number of iterations to converge.
%We design a {\em closed momentum loop} variant of \tuner to control algorithmic momentum, compensate for asynchrony and accelerate convergence.
%We use the formula in~\eqref{equ:exp_async_update} to model the dynamics in the system, where the total momentum, $\mu_T$, includes both asynchrony-induced and algorithmic  momentum, $\mu$, in~\eqref{eqn:momentum_gd}.
%\begin{equation}
%	\mathbb{E}[ x_{t+1} - x_t ]
%	= \mu_T \mathbb{E}[x_t - x_{t-1}] - \alpha \mathbb{E}\nabla f(x_{t})
%\label{equ:exp_async_update}
%\end{equation}
%We first use this expression to design an robust estimator $\hat{\mu}_T$ for the value of total momentum.
%%This estimator is a basic building block of \asynctuner, that {\em removes the need to manually compensate for the effects of asynchrony}.
%Given $\hat{\mu}_T$,
%we use it to adjust the value of algorithmic momentum so that the total momentum matches the \emph{target momentum} decided by \tuner in Algorithm~\ref{alg:basic-algo}. Specifically, we %\asynctuner  %(in Appendix~\ref{sec:async_yf})
%uses a simple negative feedback loop to achieve the adjustment. We refer to Appendix~\ref{sec:async_app} for details on estimator $\hat{\mu}_T$ and \Asynctuner in Algorithm~\ref{alg:async-algo}.
%%\Asynctuner in Algorithm~\ref{alg:async-algo} (in Appendix~\ref{sec:async_app}) %(in Appendix~\ref{sec:async_yf})
%%uses a simple negative feedback loop to achieve the adjustment.
%Figure~\ref{fig:we-can-measure} visually demonstrates the mechanism of \Asynctuner in handling the momentum dynamics under asynchrony. In asynchronous-parallel setting, the measured total momentum is strictly higher than the algorithmic momentum (middle plot), as expected from theory.
%Closing the feedback loop (right plot) leads to total momentum matching the target momentum and, as we will see, improves performance significantly.
%
%\begin{figure}
%\centering
%\includegraphics[width=0.95\linewidth]{experiment_results/resnet/mom_dynamic_3_annotated.pdf}
%	\caption{
%%	Momentum dynamics on CIFAR100 ResNet.
%	Running \tuner on a ResNet, total momentum equals algorithmic value in a synchronous setting (left). Total momentum is greater than algorithmic value on 16 asynchronous workers, due to asynchrony-induced momentum (middle).
%	\asynctuner automatically lowers algorithmic momentum and brings total momentum to match the target value (right).
%	Red dots are total momentum estimates, $\hat{\mu}_T$, at each iteration.
%The solid red line is a running average of $\hat{\mu}_T$.
%	}
%	\label{fig:we-can-measure}
%\end{figure}
%

%%%%%%%%%%%%%%%%%%%%%% below are old backup versions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%\paragraph{Measuring the momentum dynamics}
%\Asynctuner estimates total momentum $\mu_{T}$ on a running system and uses a negative feedback loop to adjust algorithmic momentum accordingly.
%Equation~\eqref{equ:exp_async_update} gives an estimate of $\hat{\mu_T}$ on a system with staleness $\tau$, based on \eqref{equ:exp_async_update}.
%\begin{align}
%\hat{\mu_T}
%					= \mathop{\mathsf{median}}\left(
%							\frac{x_{t - \tau} - x_{t - \tau-1} + \alpha \nabla_{S_{t-\tau -1}} f(x_{t - \tau - 1} )}
%							{x_{t - \tau-1} - x_{t - \tau-2}}
%					\right)
%\label{eqn:momentum_measurement}
%\end{align}
%We use $\tau$-stale model values to match the staleness of the gradient,  and perform all operations in an elementwise fashion.
%This way we get a total momentum measurement from each variable;
%the median combines them into a more robust estimate.

%\label{subsec:closed_loop_YF}
%\begin{figure}
%\centering
%\includegraphics[width=0.95\linewidth]{experiment_results/resnet/mom_dynamic_3_annotated.pdf}
%	\caption{
%	Momentum dynamics on CIFAR100 ResNet.
%	Running \tuner, total momentum is equal to algorithmic momentum in a synchronous setting (left). Total momentum is greater than algorithmic momentum on 16 asynchronous workers, due to asynchrony-induced momentum (middle).
%	Additionally applying the momentum feedback loop of \asynctuner, lowers algorithmic momentum and matches total momentum to target value (right).
%	Red dots are individual total momentum estimates, $\hat{\mu}_T$, at each iteration, with
%the solid red line as its running average.
%	}
%	\label{fig:we-can-measure}
%\end{figure}

%\paragraph{Closing the asynchrony loop}
%Given a reliable measurement of $\mu_{T}$,
%we can use it to adjust the value of algorithmic momentum so that the total momentum matches the \emph{target momentum} as decided by \tuner in Algorithm~\ref{alg:basic-algo}.
%\Asynctuner in Algorithm~\ref{alg:async-algo} (in Appendix~\ref{sec:async_app}) %(in Appendix~\ref{sec:async_yf})
%uses a simple negative feedback loop to achieve the adjustment.
%Figure~\ref{fig:we-can-measure} demonstrates that under asynchrony the measured total momentum is strictly higher than the algorithmic momentum (middle plot), as expected from theory;
%closing the feedback loop (right plot) leads to total momentum matching the target momentum.
%Closing the loop, as we will see, improves performance significantly.
%

%To handle the momentum dynamics of asynchronous parallelism, we propose a {\em closed momentum loop} variant of \tuner.
%After some preliminaries, we show the mechanism of the extension:
%it measures the dynamics on a running system and controls momentum with a negative feedback loop.
%\paragraph{Preliminaries}
%Asynchrony is a popular parallelization technique \citep{recht2011hogwild} that avoids synchronization barriers.
%When training on $M$ asynchronous workers, staleness (the number of model updates between a worker's read and write operations) is on average $\tau=M-1$,
%i.e., the gradient in the SGD update is delayed by $\tau$ iterations as $\nabla f_{S_{t - \tau}}(x_{t - \tau} )$.
%Asynchrony yields faster steps, but can
%increase the number of iterations to achieve the same solution,
%a tradeoff between hardware and statistical
%efficiency~\citep{DBLP:journals/pvldb/ZhangR14}.
%\citet{mitliagkas2016asynchrony} interpret asynchrony as added momentum dynamics.
%Experiments in \citet{hadjis2016omnivore} support this finding, and demonstrate that reducing algorithmic momentum can compensate for asynchrony-induced momentum
%and significantly reduce the number of iterations for convergence.
%Motivated by that result, we use the model
%in~\eqref{equ:exp_async_update}, where the total momentum, $\mu_T$, includes both asynchrony-induced and algorithmic  momentum, $\mu$, in~\eqref{eqn:momentum_gd}.
%\begin{equation}
%	\mathbb{E}[ x_{t+1} - x_t ]
%	= \mu_T \mathbb{E}[x_t - x_{t-1}] - \alpha \mathbb{E}\nabla f(x_{t})
%\label{equ:exp_async_update}
%\end{equation}
%We will use this expression to design an estimator for the value of total momentum, $\hat{\mu_T}$.
%This estimator is a basic building block of \asynctuner, that {\em removes the need to manually compensate for the effects of asynchrony}.
%
%
%
%\paragraph{Measuring the momentum dynamics}
%\Asynctuner estimates total momentum $\mu_{T}$ on a running system and uses a negative feedback loop to adjust algorithmic momentum accordingly.
%Equation~\eqref{equ:exp_async_update} gives an estimate of $\hat{\mu_T}$ on a system with staleness $\tau$, based on \eqref{equ:exp_async_update}.
%\begin{align}
%\hat{\mu_T}
%					= \mathop{\mathsf{median}}\left(
%							\frac{x_{t - \tau} - x_{t - \tau-1} + \alpha \nabla_{S_{t-\tau -1}} f(x_{t - \tau - 1} )}
%							{x_{t - \tau-1} - x_{t - \tau-2}}
%					\right)
%\label{eqn:momentum_measurement}
%\end{align}
%We use $\tau$-stale model values to match the staleness of the gradient,  and perform all operations in an elementwise fashion.
%This way we get a total momentum measurement from each variable;
%the median combines them into a more robust estimate.
%
%\label{subsec:closed_loop_YF}
%\begin{figure}
%\centering
%\includegraphics[width=0.95\linewidth]{experiment_results/resnet/mom_dynamic_3_annotated.pdf}
%	\caption{
%	Momentum dynamics on CIFAR100 ResNet.
%	Running \tuner, total momentum is equal to algorithmic momentum in a synchronous setting (left). Total momentum is greater than algorithmic momentum on 16 asynchronous workers, due to asynchrony-induced momentum (middle).
%	Using the momentum feedback mechanism of \asynctuner, lowers algorithmic momentum and brings total momentum to match the target value on 16 asynchronous workers (right).
%	Red dots are individual total momentum estimates, $\hat{\mu}_T$, at each iteration.
%The solid red line is a running average of those estimates.
%	}
%	\label{fig:we-can-measure}
%\end{figure}
%
%\paragraph{Closing the asynchrony loop}
%Given a reliable measurement of $\mu_{T}$,
%we can use it to adjust the value of algorithmic momentum so that the total momentum matches the \emph{target momentum} as decided by \tuner in Algorithm~\ref{alg:basic-algo}.
%\Asynctuner in Algorithm~\ref{alg:async-algo} (in Appendix~\ref{sec:async_app}) %(in Appendix~\ref{sec:async_yf})
%uses a simple negative feedback loop to achieve the adjustment.
%Figure~\ref{fig:we-can-measure} demonstrates that under asynchrony the measured total momentum is strictly higher than the algorithmic momentum (middle plot), as expected from theory;
%closing the feedback loop (right plot) leads to total momentum matching the target momentum.
%Closing the loop, as we will see, improves performance significantly.
%%Note for asynchronous-parallel training, as the estimates and parameter tuning is unstable in the beginning when there are only a small number of iterations, we use initial learning $\frac{1}{\tau + 1}$ instead of $1.0$ to prevent overflow in the beginning.
%
%%\begin{algorithm}[H]
%%	\caption{\Asynctuner}
%%	\begin{algorithmic}[1]
%%%	\State Input: $\mu\gets0$, $\alpha \gets \frac{1}{\tau + 1}$, $\gamma\gets0.01, \tau$ (staleness)
%%	\State Input: $\mu\gets0$, $\alpha \gets 0.0001$, $\gamma\gets0.01, \tau$ (staleness)
%%	\For { $t\gets1$ to $T$}
%%	\State $x_t\!\gets\!x_{t - 1} + \mu (x_{t - 1} - x_{t - 2} ) - \alpha \nabla_{S_t} f(x_{t - \tau - 1} )$
%%	\State $\mu^*,\alpha \gets \Call{\tuner}{\nabla_{S_t} f(x_{t - \tau - 1} ), \beta}$ %(get momentum from the dynamic range)
%%	\State $\hat{\mu_T}
%%					\gets \mathop{\mathsf{median}}\left(
%%							\frac{x_{t - \tau} - x_{t - \tau-1} + \alpha \nabla_{S_{t-\tau-1}} f(x_{t - \tau - 1} )}
%%							{x_{t - \tau-1} - x_{t - \tau-2}}
%%					\right)$ \Comment{Measuring total momentum}
%%	\State $\mu \leftarrow \mu + \gamma \cdot (\mu^* - \hat{\mu_T})$ \Comment{Closing the loop}
%%	\EndFor
%%\end{algorithmic}
%%\label{alg:async-algo}
%%\end{algorithm}
%


%auto-ignore
\providecommand{\MainFolder}{..}
\documentclass[\MainFolder/Text.tex]{subfiles}
\begin{document}

\section{Homotopy transfer and effective action}\label{Sec:HPL}

In \cite{Doubek2018}, they consider multilinear operations $l_{lg}: V^{\otimes l} \rightarrow \R$ for $l\ge 1$, $g\ge 0$ on an odd symplectic vector space~$V$ and write down an action $\Action\in \Fun(V)$ in the form of~\eqref{Eq:MyAction} with~$\MC_{lg}$ replaced by~$l_{lg}^+$. We remark that their ``vertices'' are $l^+_{lg}(v,\dotsc,v)$ for a ``field'' $v\in V$, whereas ours are $\MC_{lg}(v_1,\dotsc,v_l)$ for a ``string of fields'' $v_1\dotsb v_l\in \CycB(V)$. They consider the Schwarz's canonical $\BV$-operator on $\Fun(V)$ from~\cite{Schwarz1992} and show that $\Action$ satisfies the quantum master equation if and only if $(l_{lg})$ satisfy the relations of a quantum $\LInfty$-algebra.\footnote{This is equivalent to the notion of a loop homotopy algebra from \cite{Markl1997} and to string brackets in closed string field theory from \cite{Zwiebach1992}.} On the other hand, we have the string $\BV$-operator on $\Fun(\CycB(V))$ and our action \eqref{Eq:MyAction} satisfies the quantum master equation if and only if $\MC=(\MC_{lg})$ is a Maurer-Cartan element for $\dIBL(\CycC(V))$. Next, they consider a deformation retract ($\eqqcolon\mathrm{DR}$) as in \eqref{Eq:DefRetr} and obtain explicit formulas for the homotopy transfered quantum $\LInfty$-algebra on $V'$ together with all maps and homotopies via the Homological Perturbation Lemma ($\eqqcolon\mathrm{HPL}$). In what follows, we will sketch how to apply their construction to $\IBLInfty$-algebras. We stress that the details have NOT been done yet!

A DR \eqref{Eq:DefRetr} induces a DR
\begin{equation*}
\begin{tikzcd}
\bigl(\CycC(V),\OPQ_{110}\bigr) \arrow[loop left]{l}{K_\CycC}\arrow[shift left]{r}{P_\CycC} & \arrow[shift left]{l}{I_\CycC} \bigl(\CycC(V'),\OPQ_{110}'\bigr),
\end{tikzcd}
\end{equation*}
which further induces a DR
\begin{equation}\label{Eq:SDRSDR}
\begin{tikzcd}
\bigl(\Fun(B(V)),\hat{\OPQ}_{110}\bigr) \arrow[loop left]{l}{K}\arrow[shift left]{r}{P} & \arrow[shift left]{l}{I} \bigl(\Fun(B(V')),\hat{\OPQ}_{110}'\bigr).
\end{tikzcd}
\end{equation}
In~\cite[Remark~3]{Doubek2018}, they write down a formula for $K$ on $\Fun(V)$ given $\Htp$ using a ``tensor trick'' due to Eilenberg Mac-Lane; the same method may apply to get~$K_C$ from~$\Htp$ on $\CycC(V)$ and $K$ on $\Fun(\CycB(V))$ from $K_C$ in our case. With such $K$'s, one can take $P_{\CycC}$ and $P$, resp.~$I_{\CycC}$ and~$I$ to be the natural extensions of $\iota^*$, resp.~$\pi^*$. Note that any surjective quasi-isomorphism over $\R$ is a deformation retraction, but their formula is explicit and preserves special DR's, i.e., DR's satisfying $\Htp^2 = \Htp \iota = \pi \Htp = 0$ ($\eqqcolon\mathrm{SDR}$). \ToDo[caption={injectiv qi},noline]{Are injective quasi-isomorphisms sections of deformatino retractions?} The crucial idea of~\cite{Doubek2018} translated to our situation is to view $\BVOp$ and $\BVOp^\MC$ as perturbations of $\{\FreeAction,\cdot\} = \hat{\OPQ}_{110}$, which we denote by~$\delta^{(1)}$ and~$\delta^{(2)}$, respectively, and apply the HPL from~\cite{Crainic2004}:

For $i=1$, $2$, suppose that $\delta^{(i)}$ is ``small'', i.e., that $(\Id - \delta^{(i)} K)$ is invertible, and consider the maps
\begin{align*}
 \BVOp^{(i)} &\coloneqq \hat{\OPQ}_{110}' + P(\Id - \delta^{(i)}K)^{-1}\delta^{(i)} I = \hat{\OPQ}_{110}' + P \delta^{(i)} I + P \delta^{(i)} K \delta^{(i)} I + \dotsb ,\\
 I^{(i)} &\coloneqq I + K(\Id - \delta^{(i)}K)^{-1}\delta^{(i)} I = I + K \delta^{(i)} I + K \delta^{(i)} K \delta^{(i)} I + \dotsb,\\
 P^{(i)} &\coloneqq P + P(\Id-\delta^{(i)}K)^{-1}\delta^{(i)} K = P + P \delta^{(i)} K + P \delta^{(i)} K \delta^{(i)} K + \dotsb,\\
 K^{(i)} &\coloneqq K + K(\Id-\delta^{(i)}K)^{-1}\delta^{(i)}K = K + K\delta^{(i)} K + K \delta^{(i)} K \delta^{(i)} K + \dotsb.
\end{align*}
The HPL asserts that if \eqref{Eq:SDRSDR} is an SDR, then the following are SDR's as well:
\begin{equation*}\begin{tikzcd}[execute at end picture={
\draw[->,dashed] (3.5,1.5) to[out=0,in=90] node[midway,right,xshift=.5cm]{$\delta^{(1)} = \BVOp_0$} (5,.75) to[out=-90,in=0] (3.5,0);
\draw[->,dashed] (3.5,1.5) to[out=0,in=0] node[pos=0.8,right,xshift=.3cm]{$\delta^{(2)} = \BVOp_0 + \{\IntAction,\cdot\}$} (3.5,-1.5);
}]
\bigl(\Fun(B(V)),\hat{\OPQ}_{110}\bigr) \arrow[loop left]{l}{K}\arrow[shift left]{r}{P} & \arrow[shift left]{l}{I} \bigl(\Fun(B(V')),\hat{\OPQ}_{110}'\bigr) \\
\bigl(\Fun(B(V)),\BVOp \bigr) \arrow[loop left]{l}{K^{(1)}}\arrow[shift left]{r}{P^{(1)}} & \arrow[shift left]{l}{I^{(1)}} \bigl(\Fun(B(V')),\BVOp^{(1)}\bigr)\\
\bigl(\Fun(B(V)),\BVOp^\MC \bigr) \arrow[loop left]{l}{K^{(2)}}\arrow[shift left]{r}{P^{(2)}} & \arrow[shift left]{l}{I^{(2)}} \bigl(\Fun(B(V')),\BVOp^{(2)}\bigr)
\end{tikzcd}\end{equation*}
One defines the \emph{effective action}
$$W \coloneqq \log\bigl(P^{(1)}(e^{\IntAction})\bigr) \in \Fun(\CycB(V'))$$
and the \emph{path integral}
$$ Z \coloneqq L_{e^{-W}} \circ P^{(1)} \circ L_{e^{\IntAction}}: \Fun(\CycB(V)) \rightarrow \Fun(\CycB(V')). $$
Under certain circumstances, the following formulas hold:
\begin{equation}\label{Eq:NiceEqns}
\BVOp^{(1)} = P\BVOp_0 I,\quad \BVOp^{(2)}=\BVOp^{(1)} + \{W,\cdot\}^{(1)}\quad\text{and}\quad P^{(2)} = Z.
\end{equation}
This is proven in \cite{Doubek2018} on $\Fun(V)$ when $V'=\Harm$ is a ``harmonic'' subspace in a Hodge decomposition $V = \Harm \oplus C$ into odd symplectic subspaces, $\pi$ and $\iota$ are the canonical projection and inclusion, respectively, the homotopy $\Htp$ is such that $(\pi,\iota,\Htp)$ is an SDR, and the homotopy $K$ was constructed from $\Htp$ via the tensor trick. Since we deal with the string $\BV$-operator on $\Fun(\CycB(V))$, we can not talk about this ``symplectic compatibility'' and the proof of \eqref{Eq:NiceEqns} might be based on another arguments.

\begin{Question}[HPL and $\IBLInfty$]\label{Q:EqForm}
If one picks an SDR of $V$ onto a harmonic subspace~$\Harm$ as above (basically equivalent to the setting of \cite[Section~11]{Cieliebak2015}) and constructs $K_\CycC$ and $K$ in a particular way, can one achieve that \eqref{Eq:NiceEqns} and the following identities hold?
$$ \BVOp^{(1)} = \BVOp_0',\quad \BVOp^{(2)} = \BVOp^\MC, \quad W = \Action_{\HTP_* \MC},\quad P^{(1)} = e^\HTP,\quad P^{(2)}= e^{\HTP^\MC}. $$
Here, $\Action_{\HTP_*\MC}$ denotes the action \eqref{Eq:MyAction} for the Maurer-Cartan element $\HTP_*\MC$.
\end{Question}

\begin{Remark}[On $\BV$-formalism for $\IBLInfty$]
\begin{RemarkList}
\item As summarized in \cite[Section~5]{Doubek2018}, given a $\BV$-action $\Action$, there are various approaches to obtain $W$ and $Z$ as summations over Feynman graphs (see \cite{Mnev2017} for the stationary phase formula approach).
\item The appearance of Feynman graphs can be explained from the proof of \cite[Theorem~2]{Doubek2018}, where they show that in the special setting above, it holds
$$ P^{(1)} = P e^{D_{\Prpg}} $$
for an order $\le 2$ differential operator $D_{\Prpg}$ which ``connects'' two legs with the propagator~$\Prpg$ (obtained by ``rising one index'' of $\Htp$ using the odd symplectic form). This is reminiscent of the Wick's Theorem for the (formal) perturbative expansion of the path integral (the classical approach to quantum field theories).
\item Having a $\BV$-formulation of the $\IBLInfty$-theory, it is intriguing to compare it to~\cite{Muenster2011}, where certain $\IBLInfty$-structures are considered in the context of open-closed string field theory.\qedhere
\end{RemarkList}
\end{Remark}
\end{document}


\documentclass[]{article}

\usepackage{graphicx}
\usepackage{longtable}
\usepackage{hyperref}
\usepackage{color}
\usepackage{soul}
\usepackage{amsmath}
\usepackage{amssymb}

\DeclareRobustCommand{\hlcyan}[1]{{\sethlcolor{cyan}\hl{#1}}}
\DeclareRobustCommand{\hlgreen}[1]{{\sethlcolor{green}\hl{#1}}}
\DeclareRobustCommand{\hlred}[1]{{\sethlcolor{red}\hl{#1}}}
\DeclareRobustCommand{\hlyellow}[1]{{\sethlcolor{yellow}\hl{#1}}}
\DeclareRobustCommand{\hlorange}[1]{{\sethlcolor{orange}\hl{#1}}}

%opening
\title{Session 9}
\author{Fakhir}

\begin{document}

\maketitle

\section*{Solutions}

\begin{enumerate}
	\item \begin{enumerate}
		\item For continuity $\lim_{x\to0^{-}} f(x) = \lim_{x\to0^{+}} f(x) = 6$.
		\item First derivative of the first piece must be equal to the first derivative of the second piece at 0. This means:
		$$ f'(0^{-}) = f'(0^{+})$$
		$$ 2ax + b = 10x^{4}+12x^{3}+8x+5 $$
		Putting $x = 0$ we get:
		$$b = 5$$
		\item \textit{(According to MiT solutions, no need to check this)} Second derivative of the first piece must be equal to the second derivative of the second piece at 0. This means:
		$$ f''(0^{-}) = f''(0^{+})$$
		$$ 2a = 40x^{3}+36x^{2}+8 $$
		Putting $x = 0$ we get:
		$$a = 4$$

		\hlred{MiT Solution says: The first derivative has to be equal on both sides. We do not need to check the second derivative. So $b=5$ and a can be any real number.}
	\end{enumerate}

	\item \begin{enumerate}
		\item For continuity $\lim_{x\to1^{-}} f(x) = \lim_{x\to1^{+}} f(x)$. So plugging in $x=1$ in both pieces we get:

		$$ a+b+6 = 20 $$
		$$ a+b = 14 $$
		\item First derivative of the first piece must be equal to the first derivative of the second piece at 1. This means:
		$$ f'(1^{-}) = f'(1^{+})$$
		$$ 2a+b = 10+12+8+5 $$
		$$ 2a+b = 35 $$

		Solving these two simultaneous equations we get:
		$$ 2a + (14-a) = 35 $$
		$$ a + 14 = 35 $$
		$$ a = 21 $$
		$$ b = -7 $$

		Hence $a=21$ and $b=-7$.

	\end{enumerate}

\end{enumerate}

\end{document}

mit-ocw/[in progress] Single Variable Calculus, 2010/my solutions/1. Differentiation/Session9.tex