% Chapter Template
\chapter{Unsupervised Matching}%
\label{chap:unsupervised_matching}

\section{Linear Assignment Using Sentence Embeddings}%
\label{sec:linear_assignment_using_sentence_embeddings}

Word embeddings represent single tokens or n-grams such as \emph{San Francisco} depending on the implementation.
Yet, word2vec suggested and proved that word embeddings are compositional~\cite{mikolovDistributed2013}.
Research then moved on to study the representation of longer pieces of text like documents, paragraphs and sentences.
Implementations like \textcite{le_distributed_2014} extended the skip-gram idea from \textcite{mikolovDistributed2013} to learn the feature vectors for \emph{paragraphs} and used them to predict surrounding paragraphs in the text.
Approaches like \textcite{kiros_skip-thought_2015} trained an encoder that constructed surrounding sentences to learn sentence representations.
However, corpora in question for the given studies are continuous.
When the document collection we would like to show on a latent space is not part of a longer text but occur as \emph{discrete} pieces, that assumption does not hold.
Regarding dictionary definitions, we cannot rely on continuous models.
Our dictionary definitions consists of with of 10 to 11 words each with no relation from one distinct dictionary definition to another.
Refer to Table~\ref{tab:en_it_examples} for examples of a typical collection of definitions.

With such short pieces of text, considering the scope of a possible model could have, instead of paragraph embeddings we can talk about \emph{sentence embeddings}.
A sentence embedding model should ideally capture the collective meaning of the short text where every word is potentially informative and discriminative.

\textcite{wieting_towards_2015} studied sentence embeddings and reported that averaging word embeddings that make up a sentence to get sentence embeddings is a valid and surprisingly effective approach.
\textcite{aroraSimple2016} built upon the simple model and has shown that weighed average of word vectors perform so well, their publication is called; \citetitle{aroraSimple2016}.
In the suggested approach, word embeddings that make up a sentence is weighed with a scale called \emph{smooth inverse frequency} and averaged across the sentence.
Smooth inverse frequency is suggested as
\begin{displaymath}
    \text{SIF (w)} = \frac{a}{a + p(w)}
\end{displaymath}
where $a$ is a hyperparameter and $p(w)$ is the estimated word probability~\cite{aroraSimple2016}.

Using smooth inverse frequency weighting, word embeddings $v_w \in R^{d}$ where word $w$ is in a vocabulary $V$ can be averaged over a sentence $S$ such that $S \subset V$ to get sentence embedding $v_S$ in the same dimensionality $R^{d}$.
\begin{equation}
    v_S = \frac{1}{|S|}\sum_{w \in S}\text{SIF (w)}v_{w}
\end{equation}

The authors point out that the metric is similar to \tfidf{} weighting scheme if \enquote{one treats a \enquote{sentence} as a \enquote{document} and make the reasonable assumption that the sentence doesn't typically contain repeated words}~\cite{aroraSimple2016}.
These assumptions hold for us so we scaled our word embeddings using \tfidf{} weights to get \emph{sentence embeddings}.

\begin{equation}
    v_S = \frac{1}{|S|}\sum_{w \in S}\text{tf-idf}_{w,S} v_w
\end{equation}

Parallel to \citeauthor{aroraSimple2016}, \textcite{zhao_ecnu_2015} used two approaches for sentence embeddings in order to solve SemEval-2015 Task 2: Semantic Textual Similarity.\footnote{\url{http://alt.qcri.org/semeval2015/task2}}
First, for a sentence $S = (w_{1}, w_{2}, \dots, w_{s})$ where the length of the presumably small sentence is $|S| = s$ and the word embedding of a word $w$ is $v_w$;
\begin{itemize}
    \item They summed up the word embeddings of the sentence $\sum_{t \in S}v_{t}$
    \item Used information content~\cite{saric_takelab_2012} to weigh each word's LSA vector $\sum_{w \in S} I(w) v_{w}$
\end{itemize}
Both approaches results in a vector that is in the same dimensions $R^{d}$ as the original word representations.

\textcite{edilson_a._correa_nilc-usp_2017} expanded upon this simple yet effective idea to tackle the SemEval-2017 Task 4\footnote{\url{http://alt.qcri.org/semeval2017/task4}}, Sentiment Analysis in Twitter.
We have mentioned the discrete short pieces of text that are present in our definition corpora.
\emph{Twitter} exhibits a similar case to our study.\footnote{\url{https://twitter.com}}
\emph{Tweets} are short pieces of text due to the 280 character constraint imposed by the platform.
In order to acquire embeddings that represented \emph{tweets}, they weighed the word embeddings that made up a tweet; $\text{tweet}_i = (w_{i1}, w_{i2}, \dots, w_{im})$ with the \tfidf{} weights.
For the \tfidf{} calculation, they cast individual weights as documents so that term frequency become the term count in a single tweet while document frequency become the number of tweets the term $w_t$ occurs.

\begin{table}
    \centering
    \begin{tabular}{l}
        \toprule
        turn red, as if in embarrassment or shame \\
        a feeling of extreme joy \\
        a person who charms others (usually by personal attractiveness) \\
        so as to appear worn and threadbare or dilapidated \\
        a large indefinite number \\
        distributed in portions (often equal) on the basis of a plan or purpose \\
        a lengthy rebuke \\
        \bottomrule
    \end{tabular}
    \caption{Some definitions from English Princeton WordNet}%
    \label{tab:en_it_examples}
\end{table}

For the \tfidf{} calculations, we followed a similar approach.
The term frequency is the raw count of a term in a dictionary definition.
While the document frequency is the number of dictionary definitions where $w$ occurs.

Then, with a term embedding matrix at hand, we have calculated definition embeddings using;
\begin{equation}
    S_{\text{emb}}(S) = \sum_{t \in S} \varB{tf_{t,S}-idf_{t}} \cdot Emb_{w}(t)
\end{equation}
Every word that makes up a definition is scaled by its vector in ${\rm I\!R}^n$, then concatenated to form sentence embeddings on ${\rm I\!R}^n$.

As we have $N$ definitions in source wordnet (English Princeton WordNet) and target wordnet we have accepted as golden or perfectly aligned, we now hypothesize that there exists a one-to-one mapping between two sets.
In order to discover this mapping, we can get leverage the sentence embeddings we just got and cast the cosine similarity between two sentence embeddings across languages as the weight between them.
Given $N$ real valued vectors from source and target wordnet this problem naively iterates over $N!$ matchings to find the case where the sum of the similarity is maximum.
Our problem is an instance of an linear assignment problem.

\begin{figure}[htbp]
    \centering
    \incfig{bipartite_graph}
    \caption{Matching sentence embeddings can be shown as a variant of finding the maximum flow in a bipartite graph. In the figure above, the connections denote the similarity between the sentences and the width of the stroke represents the magnitude of that similarity between two definition nodes. Any two pairs of definitions have some similarity defined between them yet the matched definition are picked to ensure the overall flow is maximum. In the figure above, matched nodes have the same colour. Note the \textcolor[rgb]{0.17,0.48,0.71}{blue} node, it is not assigned to the most similar sentence in order increase the overall similarity between the two disjoint sets.}%
    \label{fig:bipartite_graph}
\end{figure}

\section{Linear Assignment Algorithm}%
\label{sec:linear_assignment_algorithm}

Linear assignment problem is an optimization problem where a cost matrix is solved.
A cost matrix is formulated such that each row corresponds to a task and each column corresponds to a worker for the task.
The aim is to find an assignment such that each task is solved by one worker and the total cost is minimized.

In our case, this formulation corresponds to two sets of wordnet definitions.
The definitions are disjoint and independent with respect to their parent wordnet.
The weights among the sets are the similarity between individual dictionary definitions.
Refer to Figure~\ref{fig:bipartite_graph} for a representation of this notation.

We have calculated sentence embeddings such that each node of the graph is an $d$ dimensional sentence vector $v_S \in R^{d}$.
The weights that connect one definition to another in this bipartite graph is the cosine similarity between two sentence's sentence vectors.
Cosine similarity is constrained in $[0,1]$ where 1 is perfect similarity and 0 denotes two orthogonal vectors, or no similarity.
This is crucial for our task such that we set out to maximize the total weight in this matching.

One of the most famous solvers for the linear assignment problem is the Hungarian method~\cite{kuhn_hungarian_1955}.
Given a qualification matrix, the Hungarian method uses a heuristic to solve the assignment in $O(n^3)$ time.
We use \textcite{jonker_shortest_1987} solver for the problem.
\citeauthor{jonker_shortest_1987} improve upon the Hungarian Algorithm using initialization heuristics and shortest path algorithm of \textcite{dijkstra_note_1959}.
The time complexity is still $O(n^3)$ but in real life problems, \citeauthor{jonker_shortest_1987} is faster~\cite{ruder_discriminative_2018}.

\subsection{Creating The Cost Matrix}%
\label{sub:creating_the_cost_matrix}

The creation of the cost matrix starts with the bilingual word embedding matrix $W$.
$W$ is $m \times d$ where $d$ is the dimensionality of the word embeddings and $m$ is the size of the joint vocabulary across two wordnets $|V|$.
The definitions are parsed into term document matrices such that we obtain two matrices $T_{s}$ and $T_{t}$ for source and target dictionaries.
We weigh $T_s$ and $T_t$ using \tfidf{} as we have mentioned before, the term count is the number of times a term occurs in a definition and document frequency is the number of definitions that include the term.
The resulting matrices are $T_s'$ and $T_t'$.
In order to get sentence embedding matrices, first we normalize the term document matrices and run matrix multiplication such that;
\begin{equation}
    S_{x} = T_x' \times W
\end{equation}
using this equation, we obtain $S_s$ and $S_t$ for source and target sentence embeddings.
By multiplying of $S_s$ and the transpose of the $S_t$, $S_t^T$, we obtain a cost matrix $C$ that is immediately compatible with the linear assignment solver.
An element $c_{i,j}$ of $C$ is the cosine similarity between source definition $i$ and target definition $j$.

\subsection{Evaluation}%
\label{sub:evaluation}

The matching approach is the application of our hypothesis that there exists a one-to-one matching between two sets of dictionary definitions.
As a natural extension of this, matching definitions across wordnets results in a single \emph{answer} for each \emph{query}.
Hence we will report precision at one scores for matching approaches.
Precision at one is the fraction of correct matches throughout the experiment set.
In Chapter~\ref{chap:experiments_and_evaluation}, we will present it as a percentage rather than fraction for legibility.

The matching approaches require two sets of dictionary definitions to have same the number of definitions in both sets, or the sets should have the same \emph{cardinality}.
For an experiment run with cardinality $C$, say the number of correctly matched definitions are $q$.
Then we calculate our score using;
\begin{equation}
    P = \frac{q}{C}\%
\end{equation}


%\documentclass{llncs}
\documentclass{sigplanconf}
%%% \usepackage[top=1.5cm,bottom=1.5cm,left=2.3cm,right=2cm]{geometry}

\pagestyle{plain}
\usepackage{times}
%\usepackage[nocompress]{cite} % AR: comment this out if you wish hyperrefs
\usepackage{hyperref}

\usepackage{amsmath,amssymb, latexsym}

\usepackage{amsmath}
\usepackage{amsthm}

\usepackage{comment}
\usepackage{flushend}

\newtheorem{lemma}{Lemma}
\newtheorem{corollary}{Corollary}
\newtheorem{theorem}{Theorem}
\newtheorem*{theorem*}{Theorem}
\newtheorem{definition}{Definition}
\newtheorem*{lemma*}{Lemma}

\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage{commands}
\usepackage{liquidHaskell}
\usepackage[inference]{semantic}

\usepackage{enumerate}
%\def\url{}
\usepackage{xspace}
\usepackage{epsfig}
\usepackage{booktabs}
\usepackage{listings}
\usepackage{comment}
\usepackage{ifthen}

\newcommand{\isTechReport}{false} % true or false
\newcommand\includeProof[1]{%
  \ifthenelse{\equal{\isTechReport}{true}}
    {{#1}}
    {\ignorespaces}
\xspace}
\newcommand\includeBytestring[1]{}

%%%%%\usepackage{fancyvrb}
%%%%%\DefineVerbatimEnvironment{code}{Verbatim}{fontsize=\small}
%%%%%\DefineVerbatimEnvironment{example}{Verbatim}{fontsize=\small}
%%%%%\newcommand{\ignore}[1]{}

% command to end a proof or definition:
%\def\qed{\rule{0.4em}{1.4ex}}
\def\qed{\hfill$\Box$}

% space at the beginning of an environment:
\def\@envspa{\hspace{0.3em}}
\def\@sa{\hspace{-0.2em}}
\def\@sb{\hspace{0.5em}}
\def\@sc{\hspace{-0.1em}}

\def\sk{\smallskip}		% space before and after theorems

\newtheorem{notation}{Notation}{\itshape}{}
\newtheorem{invariant}{Invariant}
\newtheorem*{hypothesis}{Hypothesis}
\newtheorem{technical}{}
\usepackage{thmtools}

\declaretheoremstyle[%
  spaceabove=-6pt,%
  spacebelow=6pt,%
  headfont=\normalfont\itshape,%
  postheadspace=1em,%
  qed=\qedsymbol,%
  headpunct={}
]{mystyle}
\declaretheorem[name={Proof Sketch:},style=mystyle,unnumbered,
]{proofsketch}

%\newcommand{\proofsketch}{\noindent {\bf Proof Sketch: }}
%\newcommand{\qed}{\hfill\rule{2mm}{2mm}}
\newcommand\proofsketchend{\hfill\ensuremath{\qedhere}}
\newcommand\liquidtech{
	\href{http://goto.ucsd.edu/~rjhala/liquid/liquid_types_techrep.pdf}
		 {liquid types technical report}
}

\input{haskellListings}
\begin{document}

\title{
	\ifthenelse{\equal{\isTechReport}{true}}
    {{Technical Report:}}
    {}
    Refinement Types For Haskell
    \thanks{This work was supported by NSF grants
      CNS-0964702, CNS-1223850, CCF-1218344, CCF-1018672,
      and a generous gift from Microsoft Research.
    }
  }
\newcommand\showproof[1]{\texttt{proved}}
\newcommand\showproofsketch[1]{#1}%{\texttt{proof sketch}}
\newcommand\showprooftodo[1]{\texttt{TODO}}

\authorinfo{Niki Vazou \and Eric L. Seidel \and Ranjit Jhala}{UC San Diego}{}
\authorinfo{Dimitrios Vytiniotis \and Simon Peyton-Jones}{Microsoft Research}{}

\maketitle

%%\NV{Fonts:
%%SPJ:I would prefer to use math-italic for all non-terminals
%%Particular terminal symbols like Int, Bool, and keywords like 'measure' can be typewriter font
%%Types can be \tau instead of t}

\conferenceinfo{ICFP~'14}{September 1--6, 2014, Gothenburg, Sweden}
\copyrightyear{2014}
\copyrightdata{978-1-4503-2873-9/14/09}
%% \doi{nnnnnnn.nnnnnnn}

\input{abstract}
\input{intro}
\input{overview}
\input{measures}
\input{language}
\input{typing}
\input{haskell}
\input{evaluation}
\input{related}
\input{conclusions}

\subsection*{Acknowledgements}
We thank
Kenneth Knowles,
Kenneth L. McMillan,
Andrey Rybalchenko,
Philip Wadler,
and the reviewers for their
excellent suggestions and feedback about
earlier versions of this paper.

{
\bibliographystyle{plain}
\bibliography{sw}
}

\ifthenelse{\equal{\isTechReport}{true}}
{
\appendix
\input{proofs/undeclang}
\input{proofs/tracking}
\input{proofs/constants}
\input{proofs/algorithmic}
\input{extendedhaskell}
}
{}

\end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: "main"
%%% End:


\providecommand{\main}{..}
\documentclass[\main/main.tex]{subfiles}
\begin{document}
\section{Identified data correlations}
Data correlations exist between:

\begin{table}
  \begin{tabular}{|c|c|c|}
    \hline
    \textbf{First metric} & \textbf{Second metric} & \textbf{Correlation coefficient} \\
    \hline
    CpGobsExp             & CpGperCpG              & 0.9856203442596099               \\
    \hline
    CpGobsExp             & CpGperGC               & 0.9785748818167331               \\
    \hline
    CpGperCpG             & CpGperGC               & 0.9897887253514923               \\
    \hline
    dbVARCount            & DGVCount               & 1.0                              \\
    \hline
    mamPhyloP46way        & verPhyloP46way         & 0.9902257463490804               \\
    \hline
    DnaseClusteredHyp     & DnaseClusteredScore    & 0.7863337778663062               \\
    \hline
    mamPhastCons46way     & verPhastCons46way      & 0.8700263713585867               \\
    \hline
  \end{tabular}
\end{table}
\end{document}


\documentclass{article}
\usepackage{afterpage}
\usepackage{float}
\usepackage{longtable}
\usepackage{graphicx}
\usepackage{pdflscape}
\usepackage[numbers,sort&compress]{natbib}
\usepackage{psfrag}

\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{graphicx}
%\usepackage{nicefrac}
\usepackage{graphicx}
\usepackage{caption}
% \usepackage{subcaption}
\usepackage{subfigure}
% \usepackage{algorithm}
% \usepackage{paralist}
% % \usepackage[geometry]{ifsym}
\usepackage{rotating}
\usepackage{setspace}
\newcommand{\uu}[1]{\boldsymbol #1}
\usepackage{listings}
\usepackage{xcolor}
\usepackage{subfigure}
\usepackage{fullpage}
\lstset{language=C++,
                keywordstyle=\color{blue},
                stringstyle=\color{red},
                commentstyle=\color{green},
                morecomment=[l][\color{magenta}]{\#}
}
\doublespace
\begin{document}

\section*{Exact solutions}

Pure dirichlet boundary conditions with analytical solution:
\begin{align*} \nonumber
&\uu{u}(x,y)= \begin{pmatrix}
  xy\exp(x + y) + x\exp(x + y)\\
  -xy\exp(x + y) - y\exp(x + y)
\end{pmatrix}, \\
&p(x,y) = \exp(y)\sin(x),\\
&\uu{b}(x,y) = \begin{pmatrix}
 \exp(x + y)\cos(x) \\
 \exp(x + y)\sin(x) - \exp(x + y)\cos(x)
\end{pmatrix}, \\
 &r(x,y) = x\sin(2\pi x)\sin(2\pi y).
\end{align*}

\begin{figure}[h!]
    \centering
    \includegraphics[width=0.6\textwidth]{../Lshaped.png}
    \caption{Lshaped domain}
    \label{fig:awesome_image}
\end{figure}
\section*{Preconditioner results - direct application of preconditioners}

\begin{table}[h!]
\centering
\begin{tabular}{ccccccccccc}
\hline
$\ell$ & DoF &  time$_{\rm solve}$ &  time$_{\rm NL}$ &  it$_{\rm NL}$ & it$_{\rm av}$ \\
\hline
1 &      71 & 0.00 & 0.29 & 15 & 22.0 \\
2 &     242 & 0.02 & 0.56 & 16 & 81.1 \\
3 &     909 & 0.03 & 1.34 & 24 & 59.8 \\
4 &    3,283 & 0.08 & 4.14 & 29 & 52.2 \\
5 &   12,867 & 0.35 & 16.91 & 30 & 52.1 \\
6 &   51,379 & 1.87 & 85.92 & 31 & 52.8 \\
7 &  203,556 & 12.37 & 504.08 & 31 & 53.8 \\
\hline
\end{tabular}
\end{table}

\newpage

\section*{Convergence results - direct solves on linear system}

\begin{table}[h!]
\begin{center}
\begin{tabular}{cccccccccc}
\hline
$\ell$ &    Dofs $\uu{u}_h/p_h$ & $\|\uu{u}-\uu{u}_h\|_{L^2(\Omega)}$ & order & $\|\uu{u}-\uu{u}_h\|_{H^1(\Omega)}$ & order  &  $\|{p}-{p}_h\|_{L^2(\Omega)}$ & order \\
\hline
 1 & 42/8 &  8.8613e+00 &     0.00 &  5.5371e+01 &     0.00 &  4.5613e+02 &      0.00 \\
 2 & 146/23 &  4.1281e+00 &     1.10 &  4.5019e+01 &     0.30 &  1.0459e+02 &      2.12 \\
 3 & 554/78 &  6.5366e-01 &     2.66 &  1.2378e+01 &     1.86 &  2.7443e+01 &      1.93 \\
 4 & 2,010/268 &  1.1755e-01 &     2.48 &  2.9325e+00 &     2.08 &  4.6939e+00 &      2.55 \\
 5 & 7,898/1,020 &  2.5188e-02 &     2.22 &  8.7477e-01 &     1.75 &  1.1816e+00 &      1.99 \\
 6 & 31,578/4,012 &  6.3267e-03 &     1.99 &  2.7412e-01 &     1.67 &  3.3121e-01 &      1.83 \\
 7 & 125,186/15,777 &  1.4864e-03 &     2.09 &  7.4636e-02 &     1.88 &  7.6414e-02 &      2.12 \\
\hline
\end{tabular}
\caption{Convergence of velocity/pressure field}
\label{tab:NS_2D_smooth_velocity}
\end{center}
\end{table}

\begin{table}[h!]
\begin{center}
\begin{tabular}{cccccc}
\hline
$\ell$ &    Dofs $\uu{b}_h/r_h$ & $\|\uu{b}-\uu{b}_h\|_{L^2(\Omega)}$ & order & $\|\uu{b}-\uu{b}_h\|_{H({\rm curl},\Omega)}$ & order \\
\hline
1 &     13/8 &  9.8687e+00 &     0.00 &  1.2202e+01 &        0.00 \\
2 &     50/23 &  4.6256e+00 &     1.09 &  8.8619e+00 &        0.46 \\
3 &    199/78 &  1.8629e+00 &     1.31 &  4.6257e+00 &        0.94 \\
4 &    737/268 &  8.7549e-01 &     1.09 &  2.1267e+00 &        1.12 \\
5 &   2,929/1,020 &  4.2624e-01 &     1.04 &  1.0126e+00 &        1.07 \\
6 &  11,777/4,012 &  2.1315e-01 &     1.00 &  5.4336e-01 &        0.90 \\
7 &  46,816/15,777 &  1.0649e-01 &     1.00 &  2.6991e-01 &        1.01 \\
\hline
\end{tabular}
\caption{Convergence for magnetic field}
\label{tab:2D_maxwell_magnetic}
\end{center}
\end{table}
\begin{table}[h!]
\begin{center}
\begin{tabular}{cccccc}
\hline
$\ell$ &    Dofs $\uu{b}_h/r_h$ & $\|{r}-{r}_h\|_{L^2(\Omega)}$ & order & $\|{r}-{r}_h\|_{H^1(\Omega)}$ & order\\
\hline
 1 &      13/8 &     9.7025e-01 &     0.00 &  1.0103e+01 &     0.00 \\
 2 &     50/23 &     1.5270e+00 &     0.65 &  1.2310e+01 &     0.29 \\
 3 &     199/78 &     4.3060e-01 &     1.83 &  5.0480e+00 &     1.29 \\
 4 &    737/268 &     8.5258e-02 &     2.34 &  2.3952e+00 &     1.08 \\
 5 &   2,929/1,020 &    2.2436e-02 &     1.93 &  1.1695e+00 &     1.03 \\
 6 &   11,777/4,012 &    5.4642e-03 &     2.04 &  5.7658e-01 &     1.02 \\
 7 &  46,816/15,777 &  1.3809e-03 &     1.98 &  2.9065e-01 &     0.99 \\

\hline
\end{tabular}
\caption{Convergence for  multiplier variable}
\label{tab:2D_maxwell_multiplier}

\end{center}
\end{table}

\end{document}


%!TEX root = ../../report.tex

\subsection{CityEngine \cite{Parish2001} \cite{Muller2006}}
\label{sub:cityengine}

CityEngine is a three-dimensional (3D) modeling software developed by Procedural Inc. (now part of the Esri R\&D Center). Specialized in the generation of 3D urban environments. With the procedural modeling approach, CityEngine enables the efficient creation of detailed and large-scale 3D city models with a lot of control from the user. This system applies the concept of Immediate Feedback by allowing the user to immediately see the results of each change. This is implemented through a set of sliders (Figure~\ref{fig:CEinterface} top left), that are assigned to various indicators in the model. This indicators can be as high level as the \emph{size of the city} or as specific as the \emph{width} of a window or the \emph{number of floors} in a building.

The following sections explain how CityEngine faces each of the steps in the generation of a city, such as road network generation or building modeling.

\begin{figure}[htbp]
  \centering
  \includegraphics[width=\textwidth]{img/Procedural-Modeling-of-Cities/interface.jpg}
  \caption{City Engine Interface}
  \label{fig:CEinterface}
\end{figure}

\subsubsection{RoadNetwork} % (fold)
\label{ssub:roadnetwork1}

The first part to procedurally generate a city is to create a road network to become a backbone of the city and provide an overall structure. For that, CityEngine receives as input maps such as land-water boundaries and population
density. From that input a network of highways is created to connect the areas off high density population, and small roads connect to the highways.
This growth process continues until the average area of each lot is the desired one. The system have a default value, but it can be set by the user to a different one.

To implement this growth process, it uses an L-System (Section~\ref{ssub:l_systems}) that computes the road network.

\begin{figure}[htbp]
  \centering
  \includegraphics[width=0.5\textwidth]{img/Procedural-Modeling-of-Cities/Capturar.png}
  \caption{Road Map growth}
  \label{fig:city}
\end{figure}

The Figure~\ref{fig:city} shows the evolution of this process in a map of Manhattan. The first two pictures on the top shows the process in different phases during the process, the picture in the middle is the result of the process and the bottom line is the real map of Manhattan for comparison.

% subsubsection roadnetwork (end)Road Network

\subsubsection{Buildings} % (fold)
\label{ssub:buildings1}

To implement the generation of buildings, CGA was created, which is a shape grammar(Section~\ref{ssub:shape_grammars}) that was introduced in \cite{Parish2001}. It is defined as ``a novel shape grammar for the procedural modelling of CG architecture, produces building shells with high visual quality and geometric detail." To do so, this grammar uses a group of well defined production rules.

This tool allows the user to model buildings with an high control and in different ways. It can be done by text, writing production rules from a shape grammar or with a visual language similar Grasshopper 3D, that is nice for simple models but it is hard to work with more complex models, for instance, Figure~\ref{fig:CEinterface} shows a set of rules (bottom left), that is relatively small but is already difficult to follow the connections between rules.

\paragraph{Mass Modeling} % (fold)
\label{par:mass_modeling}
To model a building the first step is to create a mass model of the entire building by assembling basic shapes. With scaling, translation rotation and split applied to basic shapes namely I, L, H, U and T as shown in the Figure~\ref{fig:basic_shapes}.

\begin{figure}[htbp]
  \centering
  \includegraphics[width=0.95\textwidth]{img/Procedural-Modeling-of-Cities/MassModeling2.png}
  \caption{Basic shapes}
  \label{fig:basic_shapes}
\end{figure}

% paragraph mass_modeling (end)

The next step is to add the roof, from a set of basic roof shapes or general L-Systems.

After that, with the application of the grammar rules in the created mass, it is possible to create complexity to the level that is desired, being able to produce highly complex buildings like the one in Figure~\ref{fig:CEnewbuilding}.

\begin{figure}[]
  \centering
  \includegraphics[width=0.583\textwidth]{img/Procedural-Modeling-of-Cities/building2.png}
  \caption{Complex building modeled with CGA}
  \label{fig:CEnewbuilding}
\end{figure}

% subsubsection buildings (end)

\subsubsection{Cities} % (fold)
\label{ssub:Cities1}

The result can be a city like Figure~\ref{fig:bigCity}, with approximately 26000 buildings.

\begin{figure}[htbp]
  \centering
  \includegraphics[width=0.95\textwidth]{img/Procedural-Modeling-of-Cities/City.png}
  \caption{City with approximately 26000 buildings.}
  \label{fig:bigCity}
\end{figure}

City Engine outputs can be imported by Maya\footnote{\url{http://www.autodesk.com/products/maya/overview}}, to achieve better results. Like the Figure~\ref{fig:cityMaya}, that represents a ‘virtual’ Manhattan.

\begin{figure}[htbp]
  \centering
  \includegraphics[width=0.95\textwidth]{img/Procedural-Modeling-of-Cities/City_Maya.png}
  \caption{City rendered with Maya.}
  \label{fig:cityMaya}
\end{figure}

% subsubsection subsubsection_name (end)


% !TEX root = ../sethomas_thesis_main.tex
\section{Validation using a Case Study: A Multi-Output SMA Mandrel}\label{sec:smacm-mandrel}
\subsection{Motivation and Background}
As previously stated, Shape Memory Alloys exhibit a relatively high volumetric work density. Thus, they are an ideal candidate in creating lightweight actuators for applications where reducing the total weight of the system drastically improves the efficiency such as drone deliveries. Here, any reduced weight increases the total flight time of the drone and thus, makes it the ideal use case of lightweight SMA actuators.
In the context of drone deliveries, grippers generally consist of an actuator such as a motor and kinematic stage that converts the motion of the actuator into a gripping motion. In certain scenarios, the required gripping motion can be complex consisting of multiple outputs and radial movements such as the grippers implemented in the work by \cite{leeClosedStructureCompliantGripper2021} and in the work by \cite{singhCompactCompliantExternal2013}.
In this case study, the goal is to apply the design methodology presented in this chapter to fabricate a drone-ready gripper with an advanced gripping mechanism. Using compliant mechanisms generated by topology optimization, an advanced kinematic stage can be designed to convert the motion of the SMA actuator into a multi-output gripping motion. Based on the design approach, the multi-output SMA gripper is sized and fabricated so as to validate the methodology.
\subsection{Working Principle of the Gripper}
The working principle of the proposed SMA gripper is based on the traditional SMA actuator presented in \cref{chap:sma-model} as adapted by the design methodology described in \cref{sec:bias-compliant-methodology}. Here, the gripper consists of a simple SMA coil that acts as the active element and an accompanying compliant structure that behaves as the kinematic stage and as the biasing element.

The active SMA coil is pre-stretched by the biasing element at low temperatures and contracts when heated above its transition temperature. The biasing element, which also acts as a conversion mechanism to transform the linear actuation of the SMA coil into a gripper movement, exhibits an inherent stiffness due to the fact that it composed of flexure-based hinges. As the SMA cools down, a spring force acts on the coil due to the stiffness of the compliant mechanism. When heating the SMA, the contraction of the coil deforms the compliant biasing element creating the desired gripping motion at the output. By controlling the temperature of the SMA coil, the entire system can be made to grip and release objects.

In this application, the SMA coil is heating using Joule's heating by applying a constant voltage across it. This simple solution makes use of the internal resistance of the SMA coil to exploit the Joule's losses when passing a current through it to raise the temperature of the material. The coil, here, is cooled using passive cooling by simple convection with the surrounding air. This standard solution allows for a simple control system that does not require any external heating system which would add weight to the system. Furthermore, an H-bridge is used to supply the current and control the heating of the SMA coil. Finally, as precise control of the system is required, a hall-effect sensor or any other low profile position sensor can be used to detect the state of the gripper.

\begin{figure}[hbt!] % t for top of the page, H could be put to impose the position of the float
  \centering
  \resizebox{0.9\textwidth}{!}{\input{images/chap3/gripper-working-principle.pgf}}
  % \resizebox{0.6\textwidth}{!}{\input{images/chap7/gripper-working-principle.pgf}}
  \caption{The sizing methodology of the biased-compliant SMA gripper based on the proposed designing methodology.}
  \label{fig:mandrel-gripperwp}
\end{figure}

The working principle can be further visualised using the simplified sizing graphs as described in the work by \cite{spaggiariDesignEquationsBinary2013} and as adapted to compliant systems in \cref{subsec:passive-biasing-compliant-mech}. The SMA coil within the gripper operates between the ambient temperature and a temperature above its transition temperature. This behaviour, as mentioned previously, can be simplified into two straight lines based on its temperature. It is important to note that there exists a locus of lines representing the SMA at every temperature in between. Based on the methodology, the operating point of the gripper can be deduced using the intersection of the SMA curves and the characteristic of the designed biasing element. This characteristic will be described and validated in the following sections. The operating points are labelled in the figure as \circled{1} and \circled{2}. The maximum possible stroke of the gripper can be estimated by taking the difference between the x-values of the two operating points, $x_1-x_2$. However, the variable, $x_\mathrm{off}$, represents the distance between the SMA and the biasing-element before they are pre-stretched and attached to each other. These operating points described represent the behaviour of the gripper without a payload. In the case a payload, is present, the behaviour of the gripper and the gripping force is dependant on the size of the payload, $x_\mathrm{Obj}$. This behaviour of the payload can be simplified as a perfectly rigid object with an infinite stiffness. Thus, the intersection between the force-displacement curve of the payload and the high temperature SMA will deduce the last operating point \circled{3}. The gripping force, $F_\mathrm{Grip}$, experienced by the payload can be estimated using this last operating point as shown in the figure. Thus, as established by the design methodology presented in \cref{chap:design-methodology}, the curves of the SMA and the compliant mechanism can be used to estimate the total stroke and gripping force of the system, as represented by $x_1-x_2$ and $F_\mathrm{Grip}$ respectively.
\subsection{Designing the Integrated Biased Kinematic Stage}
The main goal of the design presented in this section is to create a multi-output gripper actuated using a single SMA coil. When designing grippers with complex outputs such as the work shown in \cite{zhakypovOrigamiInspiredReconfigurableSuction2018}, multiple active elements are used. The goal of this design is to improve these grippers by implementing an integrated system that can present multi-output gripping motion while only using a single SMA coil as an input. Here, the design is based on the 4-Point Mandrel topology presented in \cref{chap:compliant-sma}. However, here, the structure is used as the passive element as opposed to the active element proposed in the following chapter. Thus, in this gripper design, the 4-prong radial compliant mechanism is used as the passive biasing element and as the kinematic stage. Furthermore, the compliant mechanism is redesigned using flexure-based hinges so as to improve the stroke of the gripper system. Here, as the topology is limited to the 2D plane, the flexural mechanism is further improved by extending the design space to a 2.5D design, which involved stacking 2D structures along the third dimension.
\subsubsection{Articulated Parallelogram Core and Analytical Geometry Approach}
The algorithmically generated mandrel topology consists of an articulated symmetrical parallelogram (rhombus). The topology can be reduced to four identical triangles joined at one vertex by a pivot as shown in \cref{fig:mandrel-kinematic}(a). The kinematics of the design is adapted from the generated one by using hinges instead of distributed deformation. In the figure, the blue arrows represent the input while the black arrows represent the output. The design has been generated such that the SMA coils can be placed at the inputs so as to generate a radial output towards the centre when actuated.

\begin{figure}[hbt!] % t for top of the page, H could be put to impose the position of the float
  \centering
  \resizebox{\textwidth}{!}{\input{images/chap7/mandrel-kinematic-stage.tex}}
  \caption[Kinematic diagram of proposed design]{Kinematic diagram of proposed design where the black dots represent ideal pivots, the blue and black arrows represent the input and output displacement, respectively. On the left: the outward-triangle configuration with a) the initial position and b) the displaced one. On the right-hand side: the inward-triangle configuration achieving a stroke amplification with c) the initial position and d) the displaced one. e) represents mandrel topology generated with 2D topology optimization which behaves similarly to the outward version. f) shows the 2.5D adaptation of the inward version into a flexure-based mechanism distributed over multiple layers, and with a reversed actuation direction.}
  \label{fig:mandrel-kinematic}
\end{figure}

When examining the concept behind the mandrel mechanism, the conclusion can be made that the driving structure consists of four right-angled isosceles triangles which represent the four claws of the mandrel. Furthermore, the pivots, being constrained along the horizontal and vertical axes due to symmetry, force the outputs to move along a $45^{\circ}$ path. However, upon careful examination, these constraints can be satisfied in two distinct configurations as shown in \cref{fig:mandrel-kinematic}(a) and (c). The four triangles can be position inwardly or outwardly. Due to the inward-facing configuration having overlapping triangles, this topology cannot be generated from a 2D design space. The main advantage of the inward-facing configuration compared to the outward-facing configuration is the stroke amplification of the output vertices based on the stroke of the SMA coil contraction. It is also important to note that the direction of the radial output depends on the direction of the input displacement. Thus, the gripper can be made to open or close when the SMA coil is heated. By attaching the SMA coil to the vertical pivots rather than the horizontal ones, the gripper can be made to be always opened or always closed.

\subsubsection{Determining the Relationship between the Hinges and the SMA Stroke}
The stroke amplification, $\gamma$, of the system is not uniform and is dependant on the position of the mechanism, $x$. This amplification factor can be described by deriving the output vertex position, $R$, with respect to the input vertex position, $x$, and can be expressed analytically as :
\begin{equation}
\gamma(x) = \frac{\partial R(x)}{\partial x} = \frac{1}{2\sqrt{2}}\left(1-\text{sign}(\alpha)\frac{\frac{x}{2}}{\sqrt{L_{h}^2-\left(\frac{x}{2}\right)^2}} \right)
\label{eq:1}
\end{equation}
where,
\begin{equation}
\begin{split}
    R(x) &= L_{h}\cos\left(\theta(x) - \alpha\right)\\
     &= \frac{1}{\sqrt{2}} \left(\frac{x}{2} +\text{sign}(\alpha) \sqrt{L_{h}^2-\left(\frac{x}{2}\right)^2}\right),
    \label{eq:7}
\end{split}
\end{equation}
with,
\begin{equation}
\theta(x) = \arccos{\left(\frac{x}{2L_{h}}\right)} \quad \text{and} \quad \alpha=\pm\frac{\pi}{4}.
\label{eq:theta}
\end{equation}
Here, $L_h$ represents the length of the hypotenuse of each triangle, $\theta$ represents the angle between the horizontal and the hypotenuse, $\alpha$ represents the angle between the hypotenuse and the side of the triangle and can equal a value of $\pm\frac{\pi}{4}$. This angle is defined as positive for the outward-facing configuration and as negative for the inward-facing one. Here, the output stroke is majorly dependant on the sign of the angle $\alpha$. The outward configuration has a stroke amplification of less than one for almost all possible inputs, implying a stroke reduction. While, on the other hand, the inward configuration has a stroke amplification large than one. In the context of a gripper, the inward version was chosen for its larger output stroke.

\subsubsection{Simple Kinematics to a Compliant Mechanism}
The kinematic schematic is composed of only simple hinges and rigid links. This makes it the ideal candidate for implementation using flexure-based hinges. In this case, as shown in \cref{fig:mech_stages}, truncated semi-circular flexure hinges were selected for their ability to avoid high localised stress concentration and allow for an acceptable angular stroke as described in the work by \cite{torresmelgarejoModelingBendingStiffness2018}.

\begin{figure}[hbt!] % t for top of the page, H could be put to impose the position of the float
  \centering
  \resizebox{0.9\textwidth}{!}{\input{images/chap7/mandrel-mech-stages.tex}}
  \caption{Different views of the flexure-based compliant mechanism spreading over multiple stages, and parametrized flexure pivot.}
  \label{fig:mech_stages}
\end{figure}

As stated earlier, the inward-facing triangle configuration was chosen and due to fact that the triangles overlap during actuation, it makes it impossible to be implemented in a 2D design space. Thus, as shown in \cref{fig:mech_stages}, a 2.D design approach was implemented where each overlapping triangle is stacked in the 3\textsuperscript{rd} dimension. The mechanism is distributed among different superimposed layers linked at the vertices of the triangle to replicated the kinematic schematic. This adaptation to 2.5D design does not impact the functionality of the mechanism as long as the hinges are considered infinitely rigid when bending in any other direction other than the desired one. Here, two layers are implemented to accommodate the four triangles : the $L_1$ stage comprising of the green and orange triangles, and the $L_2$ stage comprising of the pink and blue triangles.

In the case of the ideal kinematic schematic, the triangles are attached at a single point to form a parallelogram. However, this is difficult to implement with a flexure-based solution due to the rigid links having a non-null width. This adds unwanted links and hinges to the kinematic chain which results in undesired Degrees of Freedom (DoF). This parasitic DoF is overcome by adding a third DoF-inhibiting stage, $L_3$, to the 2.5D design as shown in \cref{fig:mech_stages}.

As the goal of this gripper is for drone delivery purposes, another stage, which behaves as the frame of the drone, can be added to the design. For mechanism to behave as intended in the kinematic schematic, the left and right input vertices must be constraint to move along a single line. In this case, for simplicity, this constraint has been implemented using a rail. For a future drone mounted setup, an additional stage can be added to perform this required constraint, showing the advantage of the 2.5D design approach.

\subsubsection{Sizing of the Biasing Compliant Mechanism}
Based on the proposed design methodology, the goal of the mechanism is to create a kinematic stage that also behaves as the passive biasing element for the SMA coil. The inherent stiffness of the overall compliant mechanism due to the flexural hinges is harness to pre-stretch the SMA for activation. Thus, in order to size the actuator and the corresponding biasing element, an analytical model of the stiffness must be developed. Using the pseudo-rigid model, as presented in the work by \cite{heneinConceptionStructuresArticulees2005}, the flexural hinges can be considered as torsional spring with a constant angular stiffness, $K_\theta$. As detailed in \cref{subsec:passive-biasing-compliant-mech}, the stiffness of the compliant structure requires an expression for the relationship between angular position of the flexural hinge and the contraction of the SMA, $\theta(\Delta x)$. In this case, this relationship can be expressed as :
\begin{equation}\label{eq:mandrel-theta-model}
\theta(\Delta x) = \arccos{\left(\frac{\Delta x}{2L_{h}} + \cos(\theta_0)\right)},
\end{equation}
with $\theta_0$ being the resting angle at which the mechanism is printer/fabricated as shown in \cref{fig:mandrel-kinematic}(f).

As detailed in the methodology, the next step is to calculate the potential energy within the system during deformation. Due to the symmetry of the mechanism, all the hinges store the same potential energy. Here, the $L_3$ stage has 8 hinges while the stages $L_1$ and $L_2$ have 4 hinges each. Thus, the total potential energy of the whole mechanism is :
\begin{equation}\label{eq:mandrel-potential-energy-model}
U_\mathrm{tot}(\Delta x) = 16\cdot U(\Delta x)
\end{equation}
The force-displacement characteristic of the mechanism is then given by :
\begin{equation}\label{eq:mandrel-force-model}
\begin{split}
    F(\Delta x) &= \lVert -\nabla{U_\text{tot}(\Delta x)}\rVert = \frac{\partial U_\text{tot}(\Delta x)}{\partial \Delta x}\\
     &= \frac{8K_{\theta}}{L_{h}}  \frac{(\theta(\Delta x)-\theta_{0})}{\sin(\theta(\Delta x))}.
\end{split}
\end{equation}
The resulting characteristic is plotted as shown in \cref{fig:mandrel-am-expt-compare}. Furthermore, the model is validated using experimental results obtained using a pull-tester. As the experimental results follow the model quite closely, it validates the working hypothesis and approximations used during the definition of the analytical model.
\begin{figure}[hbt!] % t for top of the page, H could be put to impose the position of the float
  \centering
  \resizebox{0.9\textwidth}{!}{\input{images/chap3/am-expt-compare.pgf}}
  \caption[Validation of the analytical model of the biasing compliant mechanism using experimental results obtained using a pull-tester]{Validation of the analytical model of the biasing compliant mechanism using experimental results obtained using a pull-tester. Here, the small discrepency arises due to the creep present in the plastic structure as the mechanism returns to its original shape.}
  \label{fig:mandrel-am-expt-compare}
\end{figure}
As the force characteristic flattens unlike a traditional linear spring, the operating points of the actuator will offer higher strokes for a given SMA coil. Furthermore, as the curve also decreases in value near the low-temperature operating point \circled{1}, its implies that the gripper can exert higher gripping forces for objects with a larger diameter. This shows that the current force-displacement characteristic of the proposed compliant mechanism is well suited as a biasing element in an SMA actuator. Finally, in the figure, some plastic deformation can be observed as the mechanism was deformed beyond above its admissible range during the test. The flexural hinges exhibit a limited angular stroke which is one of the limitations of such a design. However, the maximal admissible angle before permanent plastic deformation can be estimated using the work by \cite{heneinConceptionStructuresArticulees2005} as :
\begin{equation}\label{eq:adm-theta-theory}
\Delta\theta_\text{adm} \cong \frac{3\pi\sigma_\text{adm}\sqrt{r}}{4E\sqrt{e}},
\end{equation}
which in this context can be expressed :
\begin{equation}
\begin{split}
    \Delta x_{\text{adm},+} = 2L_{h}\left(\cos(\theta_0+\Delta\theta_\text{adm})-\cos(\theta_0)\right)\\
    \Delta x_{\text{adm},-} = 2L_{h}\left(\cos(\theta_0-\Delta\theta_\text{adm}) - \cos(\theta_0)\right)
    \label{eq:adm}
\end{split}
\end{equation}
If $\mathbb{X}_\text{eq} = \{ x \;|\;  x_{2}\leqslant x \leqslant x_{1}\}$ is the set of possible operating points (see \cref{fig:mandrel-gripperwp}) and $\mathbb{X}_\text{el} =  \{ x \; | \; x_\text{off} + \Delta x_{\text{adm},+} \leqslant x \leqslant x_\text{off} + \Delta x_{\text{adm},-} \}$ is the set of admissible positions for elastic deformation as portrayed in equation \cref{eq:adm} and \cref{fig:mandrel-gripperwp}. Then, based on the design methodology presented in \cref{chap:design-methodology}, the set of feasible operating points for the actuator $\mathbb{X}_\text{f}$ is given by their intersection:
\begin{equation}
   \mathbb{X}_\text{f} = \mathbb{X}_\text{eq} \cap \mathbb{X}_\text{el}.
\end{equation}
One of the goals of the sizing methodology for the compliant mechanism is to maximise the output stroke while avoiding permanent deformation during operation. Thus, the compliant mechanism must be sized such that $\mathbb{X}_\text{eq} \subseteq \mathbb{X}_\text{el}$. This eliminates the need for precise temperature and positional control of the SMA coil during activation to protect the flexural hinges.

In this case, the output stroke of the gripper can be maximised by maximising the size $\mathbb{X}_\text{f}$ or by having the operating points be located at positions where the curve of the stroke amplification is high (from eq. \cref{eq:1}). A trade-off exists as displacing $\mathbb{X}_\text{f}$ for higher stroke amplification tends to reduce the overall size. Based on \cref{tab:sma-pt-tradeoffs}, various additional trade-offs for the proposed mandrel can be observed as summarised in \cref{tab:mandrel-tradeoffs}.

\begin{table}[hbt!]
    \centering
    \caption[Additional trade-offs observed when sizing the flexural compliant mechanism actuated by a given SMA wire or coil]{Additional trade-offs observed when sizing the flexural compliant mechanism actuated by a given SMA wire or coil. Here, $S_{\text{mech}}$ and $t_{\text{mech}}$ are the surface area and the thickness of the entire compliant mechanism, respectively.}
    \label{tab:mandrel-tradeoffs}
    \input{images/chap7/mandrel-tradeoffs.tex}
\end{table}

As seen in the table, an optimal solution can be estimated based on the design parameters. However, in the case of $L_h$ and $b$, increasing them will always result in an increased stroke while increasing the overall size of the mechanism. This shows that there exists a trade-off between the weight/size and the output stroke which will be critical to ascertain based on the gripper specifications.

\subsection{Implementation and Experimental Results}
One of the main advantages of this integrated design is the simplicity of fabrication and assembly. The entire compliant structure is printed from Nylon (PA 2200 Polyamide 12) using selective laser sintering (SLS) as shown in \cref{fig:mandrel-finalproto}. As the mechanism consists of stacked layers, the entire structure was printed as a single piece validating the simplicity of the novel design approach.

\begin{figure}[hbt!]
    \centering
    \resizebox{0.9\textwidth}{!}{\input{images/chap7/mandrel-final-proto.tex}}
    \caption[The working prototype of the biased-compliant SMA gripper]{The working prototype of the biased-compliant SMA gripper (a) opened configuration with a $0.2$mm wire diameter SMA coil (framed in red), (b) closed configuration grasping an object.}
    \label{fig:mandrel-finalproto}
\end{figure}

In \cref{fig:mandrel-stroke-estimation}, the validated analytical models are plotted against the force-displacement curves of the SMA coil. This SMA model was estimated using experimental setup where the SMA coil was maintained at a constant temperature using a PID control and a thermal camera, and was then experimentally tested using the pull-tester. With the experimental data, a simplified linear model of the cold and hot SMAs were determined using linear regression. Using these analytical models and the sizing methodology detailed in \cref{subsec:passive-biasing-compliant-mech}, the stroke of the final mandrel gripper can be estimated. In this prototype, the design parameters used are $e=0.5$ mm, $r=15$ mm, $b=4$ mm, $L_h=42.4$ mm, $x_\text{off}=27.5$ mm and $\theta_0 = \frac{\pi}{8}$. Here, an estimated linear output stroke of up to $4.5$ mm is observed for each claw.

\begin{figure}[hbt!] % t for top of the page, H could be put to impose the position of the float
  \centering
  \resizebox{0.7\textwidth}{!}{\input{images/chap7/mandrel-stroke-estimation.pgf}}
  \caption[The sizing diagram of the SMA mandrel based on the developed analytical model of the compliant mechanism and the models of the SMA coils obtained from experimental results]{The sizing diagram of the SMA mandrel based on the developed analytical model of the compliant mechanism and the models of the SMA coils obtained from experimental results. Here, based on the estimations a maximum stroke of $4.5$ mm is observed.}
  \label{fig:mandrel-stroke-estimation}
\end{figure}

The gripping force, however, is dependant on the size of the gripped object. For an object of diameter close to $x_1$, the gripping force will be maximal. Using a pair of load cells attached to two opposing claws, the gripping force was measured as shown in \cref{fig:mandrel-forcesetup}. The load cells were placed at different distances from the claws to simulated objects of varying sizes. The results of the gripping force measurements can be seen in \cref{fig:mandrel-force-temp}. The gripper shows a force close to constant for large span of SMA temperatures above its transition temperature of 80\degreeC. This constant force behaviour is ideal for a gripper and greatly simplifies the control, preventing any unintended damage to the gripped object. A maximum steady-state force of $1.78$ N was measured for the biggest payload size while using the smallest available SMA coil, whose wire diameter is $0.2$ mm. While this result is promising, it should be noted that the fabricated prototype is sub-optimal and can be further optimised for greater forces, either by optimising the compliant mechanism or by using thicker SMA coils. Increasing the wire diameter of the SMA coil comes with higher gripping forces but comes at the cost of slower cooling time or increased time delay between the opening and closing sequence of the gripper.

\begin{figure}[hbt!]
    \centering
    \resizebox{\textwidth}{!}{\input{images/chap3/mandrel-forcesetup.tex}}
    \caption{The experimental setup, using a pair of force sensors, to measure the gripping force of two opposing jaws.}
    \label{fig:mandrel-forcesetup}
\end{figure}

\begin{figure}[hbt!] % t for top of the page, H could be put to impose the position of the float
  \centering
  \resizebox{0.9\textwidth}{!}{\input{images/chap3/force-temp-filt.pgf}}
  \caption[Results of the gripping force performed at different object diameters]{Results of the gripping force performed at different object diameters. The temperature and force output were recorded in real-time using a thermal imaging camera and a force sensor, respectively.}
  \label{fig:mandrel-force-temp}
\end{figure}

In the end, the final prototype, as seen in \cref{fig:mandrel-finalproto}, was measured to weigh only $17$ g, which implies that the gripper has a maximum force-density of around $105$ N/kg. This shows that proposed mandrel gripper can be ideal for lightweight applications such as drone deliveries. Furthermore, this demonstrates the highly integrated nature of the gripper, thus, validating the design methodology presented in \cref{chap:design-methodology}.


% \begin{savequote}[8cm]
% Alles Gescheite ist schon gedacht worden.\\
% Man muss nur versuchen, es noch einmal zu denken.

% All intelligent thoughts have already been thought;\\
% what is necessary is only to try to think them again.
%   \qauthor{--- Johann Wolfgang von Goethe \cite{von_goethe_wilhelm_1829}}
% \end{savequote}

\chapter{Summary and outlook}
\label{ch:6-conclusion}

The main result of the thesis is a measurement of the CKM angle $\gamma$ using \BtoDK and \BtoDpi decays, where \D denotes a superposition of the \Dz and \Dzb states that decays to one of the final states \Kspipi and \KsKK. Approximately 17,500 \BtoDK decays\footnote{This number includes the approximately 13.5\,\% of \BtoDK that are reconstructed as \BtoDpi decays in the analysis.} and 230,000 \BtoDpi decays are analysed, obtained from the $pp$ collision data set collected by the \lhcb experiment during Run~1~and~2 of the LHC. The total data set corresponds to an integrated luminosity of about 8.7\invfb collected at centre-of-mass energies of $\sqrt s =7$, $8$, and $13\tev$. The measurement relies on the phase-space distribution of signal decays, analysed using a model-independent method based on strong-phase measurements by the CLEO and BESIII collaborations; an approach known as the model-independent BPGGSZ method. The measured \CP-violation observables are defined
\begin{align}
    \xpmdk &= r_B^{DK} \cos (\delta_B^{DK} \pm \g), & \ypmdk &= r_B^{DK} \sin (\delta_B^{DK} \pm \g),
\end{align}
and measured to be
\begin{align}
\begin{split}
    x_-^{DK} & = (\phantom{-}5.68 \pm 0.96 \pm  0.20\pm 0.23) \times 10^{-2}, \\
    y_-^{DK} & = (\phantom{-}6.55 \pm 1.14 \pm  0.25\pm 0.35) \times 10^{-2}, \\
    x_+^{DK} & = (         - 9.30 \pm 0.98 \pm  0.24\pm 0.18) \times 10^{-2}, \\
    y_+^{DK} & = (         - 1.25 \pm 1.23 \pm  0.26\pm 0.28) \times 10^{-2},
\end{split}
\end{align}
where the first uncertainty is statistical, the second arises due to systematic effects in the measurement, and the third is the propagated uncertainty on the strong-phase inputs from the CLEO and BESIII measurements. In addition, two nuissance parameters relating to \BtoDpi decays are measured. These are defined
\begin{align}
    \xxidpi &= (r_B^{DK}/r_B^{D\pi}) \cos (\delta_B^{DK} - \delta_B^{D\pi}), &
    \yxidpi &= (r_B^{DK}/r_B^{D\pi}) \sin (\delta_B^{DK} - \delta_B^{D\pi}),
\end{align}
and measured to be
\begin{align}
\begin{split}
    x_\xi^{D\pi} & = (         - 5.47 \pm 1.99 \pm  0.32\pm 0.14) \times 10^{-2}, \\
    y_\xi^{D\pi} & = (\phantom{-}0.71 \pm 2.33 \pm  0.54\pm 0.18) \times 10^{-2}.
\end{split}
\end{align}
Due to the measurement approach, the information on $\gamma$ obtained from \BtoDpi decays is encoded in the $(\xpmdk, \ypmdk)$ parameters. The measured observables have been interpreted in terms of the underlying physics parameters, yielding the results
\begin{align}
\begin{split}\label{eq:phys_results}
    \gamma          &= (68.7^{+5.2}_{-5.1})^\circ, \\
    r_B^{DK}       &= 0.0904^{+0.0077}_{-0.0075}, \\
    \delta_B^{DK}  &= (118.3^{+5.5}_{-5.6})^\circ, \\
    r_B^{\D\pi}      &= 0.0050^{+0.0017}_{-0.0017}, \\
    \delta_B^{\D\pi} &= (291^{+24}_{-26})^\circ.
\end{split}
\end{align}
This is the most precise stand-alone measurement of $\gamma$ to date, with a precision comparable to that of all earlier measurements of $\gamma$ combined. The measured value agrees with the expectation from global fits of all CKM parameters. For example, the CKMFitter group obtains  $\gamma = (65.66^{+0.90}_{-2.65})^\circ $~\cite{CKMfitter2015} in a global fit that excludes direct $\gamma$ measurements, and the obtained values and uncertainties in other world averages are similar~\cite{HFLAV,UTfit-UT}.

The thesis presented the first  BPGGSZ measurement by the \lhcb collaboration to include \BtoDpi decays as a signal channel, and a series of feasibility studies that informed the analysis strategy has also been presented. While the impact on the $\gamma$ precision from \BtoDpi decays is limited, the new strategy significantly simplified the treatment of the non-uniform phase-space acceptance in \lhcb, and lead to a significant reduction of the systematic measurement uncertainty. This will become especially important in future measurements, where the precision will no longer be limited by the statistical uncertainty to the degree that it is now.

The thesis also presented a careful analysis of the impact of neutral kaon \CP violation and material interaction on $\gamma$ measurements based on the BPGGSZ method. This was a crucial step towards to the promotion of the \BtoDpi channel to a signal channel: existing literature estimated the potential bias to be $\mathcal O(1^\circ)$ in \BtoDK decays \emph{and to scale with} $1/r_B$. This suggested potentially large biases for a \BtoDpi analysis, since $r_B^{D\pi}\simeq0.005$ is twenty times smaller than $r_B^{DK}\simeq 0.1$. However, the thesis argues that the actual impact is an order of magnitude smaller, as long as the determination of the \CP-violation observables is based on the phase-space distribution of signal decays. This is demonstrated in a number of numerical studies that take the detector geometries of the \lhcb and Belle~II detectors into account; these studies are also used to assign a (reasonably small) systematic uncertainty on the measurement results discussed above.

\section{A look towards the future} % (fold)
\label{sec:a_look_towards_the_future}

% section a_look_towards_the_future (end)
% \minitoc

Precise measurements of $\gamma$ play an important role in the physics programmes of both the \lhcb and \belle~II experiments, and the next 10--15 years will see huge improvements in the obtainable precision. Given the results of Chapter~\ref{ch:5-GGSZ-measurement}, it is clear that \lhcb is well on course to reach, even surpass, the expected goal of determining $\gamma$ with a precision of $4^\circ$ using Run~1~and~2 data~\cite{LHCbUpgradeITDR}, when more analyses are performed with the full data set. In the longer run, \lhcb is expecting to reach a precision of $1^\circ$ in the combination of $\gamma$ measurements by the end of Run~4 of the LHC, and on improving that to $\sim 0.35^\circ$ in the planned (but not-yet approved or funded) Upgrade Phase II during the 2030'ies~\cite{lhcbcollaborationPhysicsCaseLHCb2019}, with the BPGGSZ mode continuing to be an important contributor the the obtainable precision. The mode plays an even more significant role in the Belle~II physics programme, being denoted the \emph{golden mode} in the physics programme~\cite{kouBelleIIPhysics2019}, due to a much higher \KS reconstruction efficiency in the experiment. When the planned data set corresponding to an integrated luminosity of 50\invab has been collected, the uncertainty on $\gamma$ from the combination of all Belle~II results is expected to be about $1.6^\circ$~\cite{kouBelleIIPhysics2019}; this is expected to happen in 2031 given the current schedule~\cite{BelleTimescale}.

The main reason for the impressive expected improvement in precision is that current $\gamma$ measurements are dominated by statistical uncertainties in all the major signal modes. This is expected to remain true for the BPGGSZ modes throughout the period described above. The current dominating systematic uncertainty on $\gamma$ is due to the uncertainty on the measured strong-phase inputs, currently contributing an uncertainty of about $\sim1^\circ$; a number that represents a significant improvement compared to earlier analyses, due to the recently published measurements by the BESIII collaboration~\cite{BESCISI,BESCISIKSKK}. These measurements are based on a data set corresponding to an integrated luminosity of 2.9\invfb. The BESIII collaboration is planning to take data corresponding to an additional 17\invfb at the $\psi(3770)$ resonance energy during 2021--22~\cite{BESTimescale}, which will allow for significantly improved measurements. Therefore, is not expected that the strong-phase inputs will be a limiting systematic uncertainty in model-independent BPGGSZ measurements for the current generation of experiments.

It used to be the case that the dominating systematic uncertainty in \lhcb measurements of $\gamma$ with the BPGGSZ method was due to the non-trivial phase-space acceptance profile~\cite{LHCb-PAPER-2018-017}, contributing most of the $\sim2^\circ$ systematic uncertainty on $\gamma$ related to experimental effects. This would have been the largest systematic uncertainty in the measurement presented in the thesis, and would potentially become the dominating uncertainty during the first upgrade phase of \lhcb. However, as described in detail in the thesis, the uncertainty can be avoided altogether in a simultaneous analysis of \BtoDK and \BtoDpi decays, allowing for maximal use of the large data sets to be collected by the \lhcb experiment in the future.

With the results of this thesis, the world averages of $\gamma$ measurements will move closer to the value preferred by global fits. The Standard Model passes yet another test. As such, the question remains open: does the CKM picture hold up to the increasingly stringent scrutiny of the next decades, or will signs of new physics start to appear?

% section cp_violation_and_material_interaction_of_neutral_kaons (end)


\chapter{Introduction}

\section{Motivation}

Scheduling arises in countless decision processes and its abstract nature results in a wide range of practical applications, such as in healthcare \cite{sanr,operations}. Scheduling problems are accurately modelled in mathematics, hence scheduling is often interpreted as a class of mathematical optimisation problems. With many mature and developed optimisation solvers \cite{clp}, they can find solutions to large scheduling problems quickly, which are impractical using manual optimisation techniques. However, solver scalability and performance considerations often lead to complex algorithms. This combined with mathematical formulations of scheduling, result in users interpreting solvers and solutions as black boxes. Therefore, decision-making is often not transparent.
\linespace
Transparency of decision making is important. Users require to understand why a particular schedule is reasonable. For example, hospital managers may seek to understand the efficiency of their staff. Schedules may need to be robust to unpredictable changes in staff and resources, such as a nurse being unavailable to attend patients. In other scenarios, schedules may need to minimise staff to maximise profits while fulfilling all staff and patient requirements.
\linespace
Explanations are vital in communication for understanding. With many possible schedules and many variations of scheduling problems \cite{sta}, it is impractical to manually-craft explanations for every schedule of every variation. This motivates a tool to generate clear explanations.

\section{Objectives}
\label{objectives}

The first objective is to devise and implement an interactive tool that explains solvers' solutions so that schedules are human-understandable. We implement the explanation methodology outlined in the paper \cite{aes}. With argumentation, the user can easily understand scheduling in a practical environments such as nurse rostering and dialysis scheduling. The analysis of such methodology is important to understand the applicability of argumentation in practical settings.
\linespace
The second objective is to extend the theoretical and practical capabilities of argumentation for scheduling. Extensions may include interval scheduling, shop scheduling and job-dependent scheduling.

\section{Challenges}
\label{challenges}

A tool satisfying these objectives must meet the following challenges:
\begin{enumerate}
	\item\textbf{Trust:} Users of the tool need to be confident that the explanations generated are true. That is, the algorithms proposed and implemented are correct.
	\item\textbf{Accessibility:} Explanations generated from this tool are required to be accessible to computer novices without domain-specific knowledge of optimisation or argumentation.
	\item\textbf{Applicability:} Explanations should relate to makespan schedules. The tool should generate clear explanations promptly to users.
	\item\textbf{Knowledge transfer:} Explanations are constructed using knowledge structures, commonly represented using natural languages or diagrams. A challenge would be to effectively explore the usefulness of using natural languages compared to diagrams.
	\item\textbf{Background:} Explainable planning is relatively new research area compared to optimisation \cite{pe}. Challenges arise from finding related literature on the project area.
\end{enumerate}

\section{Contributions}
\label{introcontributions}

The main contributions of this project are listed as follows:
\begin{itemize}
	\item A new tool \emph{\toolname} that implements the concepts behind using argumentation for makespan scheduling. (Appendix \ref{userguide})
	\item Algorithms and their optimisations, alongside with proofs as necessary. (Chapter \ref{implementation})
	\item Theoretical applications of argumentation with theorems. (Chapter \ref{properties})
	\item A discussion on applicability of argumentation. (Chapter \ref{conclusion})
\end{itemize}